Loading src/context/service/database/Constraint.py +12 −14 Original line number Diff line number Diff line Loading @@ -86,7 +86,6 @@ def upsert_constraints( ) -> bool: uuids_to_upsert : Dict[str, int] = dict() rules_to_upsert : List[Dict] = list() if not is_delete: for constraint in constraints: constraint_uuid = constraint['constraint_uuid'] position = uuids_to_upsert.get(constraint_uuid) Loading @@ -100,11 +99,10 @@ def upsert_constraints( # Delete all constraints not in uuids_to_upsert delete_affected = False if is_delete or len(uuids_to_upsert) > 0: if len(uuids_to_upsert) > 0: stmt = delete(ConstraintModel) if service_uuid is not None: stmt = stmt.where(ConstraintModel.service_uuid == service_uuid) if slice_uuid is not None: stmt = stmt.where(ConstraintModel.slice_uuid == slice_uuid ) if not is_delete: stmt = stmt.where(ConstraintModel.constraint_uuid.not_in(set(uuids_to_upsert.keys()))) #str_stmt = stmt.compile(dialect=postgresql.dialect(), compile_kwargs={"literal_binds": True}) #LOGGER.warning('delete stmt={:s}'.format(str(str_stmt))) Loading Loading
src/context/service/database/Constraint.py +12 −14 Original line number Diff line number Diff line Loading @@ -86,7 +86,6 @@ def upsert_constraints( ) -> bool: uuids_to_upsert : Dict[str, int] = dict() rules_to_upsert : List[Dict] = list() if not is_delete: for constraint in constraints: constraint_uuid = constraint['constraint_uuid'] position = uuids_to_upsert.get(constraint_uuid) Loading @@ -100,11 +99,10 @@ def upsert_constraints( # Delete all constraints not in uuids_to_upsert delete_affected = False if is_delete or len(uuids_to_upsert) > 0: if len(uuids_to_upsert) > 0: stmt = delete(ConstraintModel) if service_uuid is not None: stmt = stmt.where(ConstraintModel.service_uuid == service_uuid) if slice_uuid is not None: stmt = stmt.where(ConstraintModel.slice_uuid == slice_uuid ) if not is_delete: stmt = stmt.where(ConstraintModel.constraint_uuid.not_in(set(uuids_to_upsert.keys()))) #str_stmt = stmt.compile(dialect=postgresql.dialect(), compile_kwargs={"literal_binds": True}) #LOGGER.warning('delete stmt={:s}'.format(str(str_stmt))) Loading