Skip to content

Commit

Permalink
Remove FK cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
schustmi committed Dec 9, 2024
1 parent 5dfe8b8 commit 0c92b8b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
13 changes: 2 additions & 11 deletions src/zenml/zen_stores/schemas/model_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,6 @@ class ModelVersionSchema(NamedSchema, RunMetadataInterface, table=True):
)
pipeline_runs: List["PipelineRunSchema"] = Relationship(
back_populates="model_version",
sa_relationship_kwargs={
"primaryjoin": "ModelVersionSchema.id==PipelineRunSchema.model_version_id",
},
)
step_runs: List["StepRunSchema"] = Relationship(
back_populates="model_version"
Expand All @@ -345,14 +342,8 @@ class ModelVersionSchema(NamedSchema, RunMetadataInterface, table=True):
sa_column=Column(Boolean, Computed("name == number"))
)

producer_run_id: Optional[UUID] = build_foreign_key_field(
source=__tablename__,
target=PipelineRunSchema.__tablename__,
source_column="producer_run_id",
target_column="id",
ondelete="SET NULL",
nullable=True,
)
# Don't use a FK here to avoid a cycle
producer_run_id: Optional[UUID] = None

# TODO: In Pydantic v2, the `model_` is a protected namespaces for all
# fields defined under base models. If not handled, this raises a warning.
Expand Down
3 changes: 0 additions & 3 deletions src/zenml/zen_stores/schemas/pipeline_run_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,6 @@ class PipelineRunSchema(NamedSchema, RunMetadataInterface, table=True):
)
model_version: "ModelVersionSchema" = Relationship(
back_populates="pipeline_runs",
sa_relationship_kwargs={
"foreign_keys": "[PipelineRunSchema.model_version_id]"
},
)

# Temporary fields and foreign keys to be deprecated
Expand Down

0 comments on commit 0c92b8b

Please sign in to comment.