Skip to content

Commit

Permalink
Make all *Reference classes orderable.
Browse files Browse the repository at this point in the history
  • Loading branch information
plypaul committed Jun 16, 2024
1 parent f68cfdc commit 6c3f229
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,20 +38,20 @@ 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

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 @@ -66,14 +66,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 @@ -101,7 +101,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 6c3f229

Please sign in to comment.