Skip to content

Commit

Permalink
Merge pull request #295 from dbt-labs/plypaul--62--orderable-references
Browse files Browse the repository at this point in the history
Make all `*Reference` classes orderable
  • Loading branch information
plypaul authored Jul 10, 2024
2 parents c9c98ca + 6c3f229 commit 5e9a3dd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions dbt_semantic_interfaces/references.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class ElementReference(SerializableDataclass):
element_name: str


@dataclass(frozen=True)
@dataclass(frozen=True, order=True)
class LinkableElementReference(ElementReference):
"""Used when we need to refer to a dimension or entity, but other attributes are unknown."""

pass


@dataclass(frozen=True)
@dataclass(frozen=True, order=True)
class MeasureReference(ElementReference):
"""Used when we need to refer to a measure.
Expand All @@ -29,7 +29,7 @@ class MeasureReference(ElementReference):
pass


@dataclass(frozen=True)
@dataclass(frozen=True, order=True)
class DimensionReference(LinkableElementReference): # noqa: D
pass

Expand All @@ -38,12 +38,12 @@ def time_dimension_reference(self) -> TimeDimensionReference: # noqa: D
return TimeDimensionReference(element_name=self.element_name)


@dataclass(frozen=True)
@dataclass(frozen=True, order=True)
class EntityReference(LinkableElementReference): # noqa: D
pass


@dataclass(frozen=True)
@dataclass(frozen=True, order=True)
class TimeDimensionReference(DimensionReference): # noqa: D
pass

Expand All @@ -52,7 +52,7 @@ def dimension_reference(self) -> DimensionReference: # noqa: D
return DimensionReference(element_name=self.element_name)


@dataclass(frozen=True)
@dataclass(frozen=True, order=True)
class MetricReference(ElementReference): # noqa: D
pass

Expand All @@ -77,14 +77,14 @@ class ModelReference(SerializableDataclass):
pass


@dataclass(frozen=True)
@dataclass(frozen=True, order=True)
class SemanticModelReference(ModelReference):
"""A reference to a semantic model definition in the model."""

semantic_model_name: str


@dataclass(frozen=True)
@dataclass(frozen=True, order=True)
class SemanticModelElementReference(ModelReference):
"""A reference to an element definition in a semantic model definition in the model.
Expand Down Expand Up @@ -112,7 +112,7 @@ def is_from(self, ref: SemanticModelReference) -> bool:
return self.semantic_model_name == ref.semantic_model_name


@dataclass(frozen=True)
@dataclass(frozen=True, order=True)
class MetricModelReference(ModelReference):
"""A reference to a metric definition in the model."""

Expand Down

0 comments on commit 5e9a3dd

Please sign in to comment.