Skip to content

Commit

Permalink
naming recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
bcdurak committed Nov 29, 2024
1 parent 169b4c6 commit ba131c0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/zenml/zen_stores/schemas/artifact_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/zenml/zen_stores/schemas/model_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/zenml/zen_stores/schemas/pipeline_run_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 8 additions & 8 deletions src/zenml/zen_stores/schemas/run_metadata_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
),
)
2 changes: 1 addition & 1 deletion src/zenml/zen_stores/schemas/step_run_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit ba131c0

Please sign in to comment.