From 5abd3e2b709aa590d15a7c3cfbcf934a08b17a93 Mon Sep 17 00:00:00 2001 From: John Davis Date: Mon, 4 Dec 2023 15:05:23 -0500 Subject: [PATCH] Set cascade_backrefs=False on WorkflowStep.workflow_outputs, add safeguard --- lib/galaxy/model/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 316f188f1af0..fd75e87931eb 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -7688,7 +7688,7 @@ class WorkflowStep(Base, RepresentById): ) post_job_actions = relationship("PostJobAction", back_populates="workflow_step", cascade_backrefs=False) inputs = relationship("WorkflowStepInput", back_populates="workflow_step") - workflow_outputs = relationship("WorkflowOutput", back_populates="workflow_step") + workflow_outputs = relationship("WorkflowOutput", back_populates="workflow_step", cascade_backrefs=False) output_connections = relationship( "WorkflowStepConnection", primaryjoin=(lambda: WorkflowStepConnection.output_step_id == WorkflowStep.id) ) @@ -8074,6 +8074,9 @@ class WorkflowOutput(Base, Serializable): def __init__(self, workflow_step, output_name=None, label=None, uuid=None): self.workflow_step = workflow_step + # Safeguard: self was implicitly merged into this Session prior to SQLAlchemy 2.0. + if object_session(workflow_step): + object_session(workflow_step).add(self) self.output_name = output_name self.label = label self.uuid = get_uuid(uuid)