YuChen Posted October 25, 2022 Report Share Posted October 25, 2022 Hi all, I have had an asset entity named "ddd" related to a shot entity and would like to create another asset entity "DDD" (i.e. the same name but convert to uppercase): import ftrack_api session = ftrack_api.Session(auto_connect_event_hub=True) cache = session.query('AssetType where name is "Cache"').one() shot = session.get('Shot', '79336930-e883-11ec-ac4e-5e4cc4698f5e') asset_args_dict = {'name': 'DDD', 'type': cache, 'parent': shot} new_asset = session.create('Asset', asset_args_dict) session.commit() I expected it should work but got a duplicate entry error: Server reported error: IntegrityError((MySQLdb._exceptions.IntegrityError) (1062, "Duplicate entry '55db6728-0392-11e9-8a89-6c626de13dde-DDD-79336930-e883-11ec-a...' for key 'asset_Asset.typeid_key'") [SQL: u'INSERT INTO asset (id, name, context_id, taskid, type_id) VALUES (%s, %s, %s, %s, %s)'] [parameters: (u'fbb10a03-e1b9-446b-b933-4100cb58ec0c', 'DDD', u'79336930-e883-11ec-ac4e-5e4cc4698f5e', None, u'55db6728-0392-11e9-8a89-6c626de13dde')] (Background on this error at: http://sqlalche.me/e/gkpj)) Traceback (most recent call last): File "L:/_temp/YuChen/dev/my_test/ftrack/simple_examples.py", line 2641, in <module> session.commit() File "L:\_temp\YuChen\dev\lib\twr_ftrack\common.zip\ftrack_api\session.py", line 1231, in commit File "L:\_temp\YuChen\dev\lib\twr_ftrack\common.zip\ftrack_api\session.py", line 1609, in _call ftrack_api.exception.ServerError: Server reported error: IntegrityError((MySQLdb._exceptions.IntegrityError) (1062, "Duplicate entry '55db6728-0392-11e9-8a89-6c626de13dde-DDD-79336930-e883-11ec-a...' for key 'asset_Asset.typeid_key'") [SQL: u'INSERT INTO asset (id, name, context_id, taskid, type_id) VALUES (%s, %s, %s, %s, %s)'] [parameters: (u'fbb10a03-e1b9-446b-b933-4100cb58ec0c', 'DDD', u'79336930-e883-11ec-ac4e-5e4cc4698f5e', None, u'55db6728-0392-11e9-8a89-6c626de13dde')] (Background on this error at: http://sqlalche.me/e/gkpj)) Closing session with pending operations not persisted. It looks like I can't create asset with the same name but different letter case. Is this an intentional design or is it a bug ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now