From 2d65ab83f11d86d82a913a6047586dd24e3d2ebf Mon Sep 17 00:00:00 2001 From: Jana Mizikova Date: Fri, 1 Nov 2019 11:27:46 +0100 Subject: [PATCH] fix(plugins): changing the way ftrack is querying entity_type this will remove the server entity duplicity error on mysql --- .../ftrack/publish/integrate_hierarchy_ftrack.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pype/plugins/ftrack/publish/integrate_hierarchy_ftrack.py b/pype/plugins/ftrack/publish/integrate_hierarchy_ftrack.py index 25c641c168..73a4d8af97 100644 --- a/pype/plugins/ftrack/publish/integrate_hierarchy_ftrack.py +++ b/pype/plugins/ftrack/publish/integrate_hierarchy_ftrack.py @@ -44,7 +44,15 @@ class IntegrateHierarchyToFtrack(pyblish.api.ContextPlugin): input_data = context.data["hierarchyContext"] - self.import_to_ftrack(input_data) + # self.import_to_ftrack(input_data) + + try: + self.import_to_ftrack(input_data) + except Exception as exc: + import sys + import traceback + self.log.info(traceback.format_exc(sys.exc_info())) + raise Exception("failed") def import_to_ftrack(self, input_data, parent=None): for entity_name in input_data: @@ -66,9 +74,9 @@ class IntegrateHierarchyToFtrack(pyblish.api.ContextPlugin): # try to find if entity already exists else: - query = '{} where name is "{}" and parent_id is "{}"'.format( - entity_type, entity_name, parent['id'] - ) + query = 'TypedContext where name is "{0}" and project.full_name is "{1}"'.format( + entity_name, self.ft_project["full_name"] + ) try: entity = self.session.query(query).one() except Exception: