Remus Avram Posted August 17, 2016 Report Share Posted August 17, 2016 Hi all, I have 2 assets in Ftrack: 'asset_name' and 'ASSET_NAME'. When I query via the API both assets, all the time I get only the first one because the name is not case sensitive. Example: assets = session.query("Asset where name is 'asset_name'").all() print len(assets) print assets[0]['name'] print assets[0]['id'] # Return: 1 asset_name 4c63aa70-6475-11e6-b6fd-005056a76761 assets = session.query("Asset where name is 'ASSET_NAME'").all() print len(assets) print assets[0]['name'] print assets[0]['id'] # Return: 1 asset_name 4c63aa70-6475-11e6-b6fd-005056a76761 Ftrack server: v3.3.30 API: v0.15.5 Link to comment Share on other sites More sharing options...
Remus Avram Posted August 30, 2016 Author Report Share Posted August 30, 2016 Is this the way how it's suppose to work, or I am doing something wrong? Link to comment Share on other sites More sharing options...
Lucas Correia Posted August 30, 2016 Report Share Posted August 30, 2016 Sorry for the delayed response on this. The comparisons when querying in the API are case-insensitive. There are arguments both for and against case sensitive comparison, and we opted to keep the default behaviour of the underlaying database. Regards, Lucas Link to comment Share on other sites More sharing options...
Remus Avram Posted August 30, 2016 Author Report Share Posted August 30, 2016 Hi Lucas, thanks for your answer! Then is there any other way to get all the assets via the API? Regards, Remus Link to comment Share on other sites More sharing options...
Lucas Correia Posted August 31, 2016 Report Share Posted August 31, 2016 Looks like I missed an important detail in your first question. You should be getting all items that matched the query, both the object named ASSET_NAME and the one named asset_name. I've tried to reproduce the behaviour by creating two objects with the same name and querying for them, and do get both results. Are you sure that you have a `ASSET_NAME` object? >>> items = session.query('AssetBuild where name is "ASSET_NAME"').all() >>> len(items) 2 Link to comment Share on other sites More sharing options...
Remus Avram Posted August 31, 2016 Author Report Share Posted August 31, 2016 Hi Lucas, thanks for checking it! You are right! It's getting all the items that matched the query. What actually happened, we published an asset via the API, and a new asset with the same name (case insensitive) via the ftrack-connect. The one published via the API get automatically renamed from 'asset_name' to 'asset_name_'. If we try to publish a new asset with the same name via de ftrack-connect we get an error that the asset exists. In my case I didn't check if the asset has the same name anymore. We will do more tests to be sure that we didn't do something wrong. Cheers! Link to comment Share on other sites More sharing options...
Lucas Correia Posted August 31, 2016 Report Share Posted August 31, 2016 That is odd, I am not aware of anything that automatically renames the asset in case of duplicates. Was the asset created via the legacy API? Link to comment Share on other sites More sharing options...
Remus Avram Posted August 31, 2016 Author Report Share Posted August 31, 2016 The asset was created through the new API. I will recheck and if it happen again I will write there the steps in order to reproduce the error. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.