diff --git a/src/zenml/zen_stores/schemas/artifact_schemas.py b/src/zenml/zen_stores/schemas/artifact_schemas.py index 15d448c92b..02e842a5fb 100644 --- a/src/zenml/zen_stores/schemas/artifact_schemas.py +++ b/src/zenml/zen_stores/schemas/artifact_schemas.py @@ -245,7 +245,7 @@ class ArtifactVersionSchema(BaseSchema, RunMetadataInterface, table=True): back_populates="artifact_versions" ) run_metadata_resources: List["RunMetadataResourceSchema"] = Relationship( - back_populates="artifact_version", + back_populates="artifact_versions", sa_relationship_kwargs=dict( primaryjoin=f"and_(RunMetadataResourceSchema.resource_type=='{MetadataResourceTypes.ARTIFACT_VERSION.value}', foreign(RunMetadataResourceSchema.resource_id)==ArtifactVersionSchema.id)", cascade="delete", diff --git a/src/zenml/zen_stores/schemas/model_schemas.py b/src/zenml/zen_stores/schemas/model_schemas.py index 7e67c1cf2b..feb4a93dc8 100644 --- a/src/zenml/zen_stores/schemas/model_schemas.py +++ b/src/zenml/zen_stores/schemas/model_schemas.py @@ -304,7 +304,7 @@ class ModelVersionSchema(NamedSchema, RunMetadataInterface, table=True): stage: str = Field(sa_column=Column(TEXT, nullable=True)) run_metadata_resources: List["RunMetadataResourceSchema"] = Relationship( - back_populates="model_version", + back_populates="model_versions", sa_relationship_kwargs=dict( primaryjoin=f"and_(RunMetadataResourceSchema.resource_type=='{MetadataResourceTypes.MODEL_VERSION.value}', foreign(RunMetadataResourceSchema.resource_id)==ModelVersionSchema.id)", cascade="delete", diff --git a/src/zenml/zen_stores/schemas/pipeline_run_schemas.py b/src/zenml/zen_stores/schemas/pipeline_run_schemas.py index db127b1b1f..d0af218b62 100644 --- a/src/zenml/zen_stores/schemas/pipeline_run_schemas.py +++ b/src/zenml/zen_stores/schemas/pipeline_run_schemas.py @@ -141,7 +141,7 @@ class PipelineRunSchema(NamedSchema, RunMetadataInterface, table=True): workspace: "WorkspaceSchema" = Relationship(back_populates="runs") user: Optional["UserSchema"] = Relationship(back_populates="runs") run_metadata_resources: List["RunMetadataResourceSchema"] = Relationship( - back_populates="pipeline_run", + back_populates="pipeline_runs", sa_relationship_kwargs=dict( primaryjoin=f"and_(RunMetadataResourceSchema.resource_type=='{MetadataResourceTypes.PIPELINE_RUN.value}', foreign(RunMetadataResourceSchema.resource_id)==PipelineRunSchema.id)", cascade="delete", diff --git a/src/zenml/zen_stores/schemas/run_metadata_schemas.py b/src/zenml/zen_stores/schemas/run_metadata_schemas.py index b8945cf60e..f4465b13e6 100644 --- a/src/zenml/zen_stores/schemas/run_metadata_schemas.py +++ b/src/zenml/zen_stores/schemas/run_metadata_schemas.py @@ -110,31 +110,31 @@ class RunMetadataResourceSchema(SQLModel, table=True): run_metadata: RunMetadataSchema = Relationship(back_populates="resources") # Relationship to link specific resource types - pipeline_run: List["PipelineRunSchema"] = Relationship( + pipeline_runs: List["PipelineRunSchema"] = Relationship( back_populates="run_metadata_resources", sa_relationship_kwargs=dict( primaryjoin=f"and_(RunMetadataResourceSchema.resource_type=='{MetadataResourceTypes.PIPELINE_RUN.value}', foreign(RunMetadataResourceSchema.resource_id)==PipelineRunSchema.id)", - overlaps="run_metadata_resources,step_run,artifact_version,model_version", + overlaps="run_metadata_resources,step_runs,artifact_versions,model_versions", ), ) - step_run: List["StepRunSchema"] = Relationship( + step_runs: List["StepRunSchema"] = Relationship( back_populates="run_metadata_resources", sa_relationship_kwargs=dict( primaryjoin=f"and_(RunMetadataResourceSchema.resource_type=='{MetadataResourceTypes.STEP_RUN.value}', foreign(RunMetadataResourceSchema.resource_id)==StepRunSchema.id)", - overlaps="run_metadata_resources,pipeline_run,artifact_version,model_version", + overlaps="run_metadata_resources,pipeline_runs,artifact_versions,model_versions", ), ) - artifact_version: List["ArtifactVersionSchema"] = Relationship( + artifact_versions: List["ArtifactVersionSchema"] = Relationship( back_populates="run_metadata_resources", sa_relationship_kwargs=dict( primaryjoin=f"and_(RunMetadataResourceSchema.resource_type=='{MetadataResourceTypes.ARTIFACT_VERSION.value}', foreign(RunMetadataResourceSchema.resource_id)==ArtifactVersionSchema.id)", - overlaps="run_metadata_resources,pipeline_run,step_run,model_version", + overlaps="run_metadata_resources,pipeline_runs,step_runs,model_versions", ), ) - model_version: List["ModelVersionSchema"] = Relationship( + model_versions: List["ModelVersionSchema"] = Relationship( back_populates="run_metadata_resources", sa_relationship_kwargs=dict( primaryjoin=f"and_(RunMetadataResourceSchema.resource_type=='{MetadataResourceTypes.MODEL_VERSION.value}', foreign(RunMetadataResourceSchema.resource_id)==ModelVersionSchema.id)", - overlaps="run_metadata_resources,pipeline_run,step_run,artifact_version", + overlaps="run_metadata_resources,pipeline_runs,step_runs,artifact_versions", ), ) diff --git a/src/zenml/zen_stores/schemas/step_run_schemas.py b/src/zenml/zen_stores/schemas/step_run_schemas.py index 75736c6d54..f878850515 100644 --- a/src/zenml/zen_stores/schemas/step_run_schemas.py +++ b/src/zenml/zen_stores/schemas/step_run_schemas.py @@ -144,7 +144,7 @@ class StepRunSchema(NamedSchema, RunMetadataInterface, table=True): back_populates="step_runs" ) run_metadata_resources: List["RunMetadataResourceSchema"] = Relationship( - back_populates="step_run", + back_populates="step_runs", sa_relationship_kwargs=dict( primaryjoin=f"and_(RunMetadataResourceSchema.resource_type=='{MetadataResourceTypes.STEP_RUN.value}', foreign(RunMetadataResourceSchema.resource_id)==StepRunSchema.id)", cascade="delete",