diff --git a/openpype/hosts/flame/startup/openpype_babypublisher/modules/ftrack_lib.py b/openpype/hosts/flame/startup/openpype_babypublisher/modules/ftrack_lib.py index 90311a5ac5..c2168016c6 100644 --- a/openpype/hosts/flame/startup/openpype_babypublisher/modules/ftrack_lib.py +++ b/openpype/hosts/flame/startup/openpype_babypublisher/modules/ftrack_lib.py @@ -389,17 +389,13 @@ class FtrackEntityOperator: return entity def get_ftrack_entity(self, session, type, name, parent): - query_no_parent = '{} where name is "{}" and project_id is "{}"'.format( + query = '{} where name is "{}" and project_id is "{}"'.format( type, name, self.project_entity["id"]) - query_with_parent = ( - '{} where name is "{}" and project_id is "{}" ' - 'and parent_id is {}').format( - type, name, self.project_entity["id"], parent["id"]) - entity = ( - session.query(query_no_parent).first() or - session.query(query_with_parent).first() - ) + try: + entity = session.query(query).one() + except Exception: + entity = None # if entity doesnt exist then create one if not entity: