Skip to content

Commit

Permalink
Merge branch 'Add_meta_to_measures,_entities,_and_dimensions' into co…
Browse files Browse the repository at this point in the history
…nsolidate_meta_config
  • Loading branch information
DevonFulcher committed Oct 24, 2024
2 parents ff611d8 + 79916e8 commit 41a22dd
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions dbt_semantic_interfaces/implementations/element_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
from typing_extensions import override

from dbt_semantic_interfaces.implementations.base import HashableBaseModel
from dbt_semantic_interfaces.protocols.meta import PydanticSemanticLayerElementConfig
from dbt_semantic_interfaces.protocols.meta import SemanticLayerElementConfig
from dbt_semantic_interfaces.protocols.protocol_hint import ProtocolHint


class SemanticLayerElementConfig(HashableBaseModel, ProtocolHint[PydanticSemanticLayerElementConfig]):
class PydanticSemanticLayerElementConfig(HashableBaseModel, ProtocolHint[SemanticLayerElementConfig]):
"""PydanticDimension config."""

@override
def _implements_protocol(self) -> PydanticSemanticLayerElementConfig: # noqa: D
def _implements_protocol(self) -> SemanticLayerElementConfig: # noqa: D
return self

meta: Dict[str, Any] = Field(default_factory=dict)
4 changes: 2 additions & 2 deletions dbt_semantic_interfaces/implementations/elements/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ModelWithMetadataParsing,
)
from dbt_semantic_interfaces.implementations.element_config import (
SemanticLayerElementConfig,
PydanticSemanticLayerElementConfig,
)
from dbt_semantic_interfaces.implementations.metadata import PydanticMetadata
from dbt_semantic_interfaces.references import (
Expand Down Expand Up @@ -51,7 +51,7 @@ class PydanticDimension(HashableBaseModel, ModelWithMetadataParsing):
expr: Optional[str] = None
metadata: Optional[PydanticMetadata]
label: Optional[str] = None
config: Optional[SemanticLayerElementConfig]
config: Optional[PydanticSemanticLayerElementConfig]

@property
def reference(self) -> DimensionReference: # noqa: D
Expand Down
4 changes: 2 additions & 2 deletions dbt_semantic_interfaces/implementations/elements/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ModelWithMetadataParsing,
)
from dbt_semantic_interfaces.implementations.element_config import (
SemanticLayerElementConfig,
PydanticSemanticLayerElementConfig,
)
from dbt_semantic_interfaces.implementations.metadata import PydanticMetadata
from dbt_semantic_interfaces.references import EntityReference
Expand All @@ -24,7 +24,7 @@ class PydanticEntity(HashableBaseModel, ModelWithMetadataParsing):
expr: Optional[str] = None
metadata: Optional[PydanticMetadata] = None
label: Optional[str] = None
config: Optional[SemanticLayerElementConfig]
config: Optional[PydanticSemanticLayerElementConfig]

@property
def reference(self) -> EntityReference: # noqa: D
Expand Down
4 changes: 2 additions & 2 deletions dbt_semantic_interfaces/implementations/elements/measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ModelWithMetadataParsing,
)
from dbt_semantic_interfaces.implementations.element_config import (
SemanticLayerElementConfig,
PydanticSemanticLayerElementConfig,
)
from dbt_semantic_interfaces.implementations.metadata import PydanticMetadata
from dbt_semantic_interfaces.references import MeasureReference
Expand Down Expand Up @@ -49,7 +49,7 @@ class PydanticMeasure(HashableBaseModel, ModelWithMetadataParsing):
non_additive_dimension: Optional[PydanticNonAdditiveDimensionParameters] = None
agg_time_dimension: Optional[str] = None
label: Optional[str] = None
config: Optional[SemanticLayerElementConfig] = None
config: Optional[PydanticSemanticLayerElementConfig] = None

@property
def reference(self) -> MeasureReference: # noqa: D
Expand Down
4 changes: 2 additions & 2 deletions dbt_semantic_interfaces/protocols/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from abc import abstractmethod
from typing import Optional, Protocol

from dbt_semantic_interfaces.protocols.meta import PydanticSemanticLayerElementConfig
from dbt_semantic_interfaces.protocols.meta import SemanticLayerElementConfig
from dbt_semantic_interfaces.protocols.metadata import Metadata
from dbt_semantic_interfaces.references import (
DimensionReference,
Expand Down Expand Up @@ -111,5 +111,5 @@ def label(self) -> Optional[str]:

@property
@abstractmethod
def config(self) -> Optional[PydanticSemanticLayerElementConfig]: # noqa: D
def config(self) -> Optional[SemanticLayerElementConfig]: # noqa: D
pass
4 changes: 2 additions & 2 deletions dbt_semantic_interfaces/protocols/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from abc import abstractmethod
from typing import Optional, Protocol

from dbt_semantic_interfaces.protocols.meta import PydanticSemanticLayerElementConfig
from dbt_semantic_interfaces.protocols.meta import SemanticLayerElementConfig
from dbt_semantic_interfaces.references import EntityReference
from dbt_semantic_interfaces.type_enums import EntityType

Expand Down Expand Up @@ -64,5 +64,5 @@ def label(self) -> Optional[str]:

@property
@abstractmethod
def config(self) -> Optional[PydanticSemanticLayerElementConfig]: # noqa: D
def config(self) -> Optional[SemanticLayerElementConfig]: # noqa: D
pass
4 changes: 2 additions & 2 deletions dbt_semantic_interfaces/protocols/measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from abc import abstractmethod
from typing import Optional, Protocol, Sequence

from dbt_semantic_interfaces.protocols.meta import PydanticSemanticLayerElementConfig
from dbt_semantic_interfaces.protocols.meta import SemanticLayerElementConfig
from dbt_semantic_interfaces.references import MeasureReference
from dbt_semantic_interfaces.type_enums import AggregationType

Expand Down Expand Up @@ -102,5 +102,5 @@ def label(self) -> Optional[str]:

@property
@abstractmethod
def config(self) -> Optional[PydanticSemanticLayerElementConfig]: # noqa: D
def config(self) -> Optional[SemanticLayerElementConfig]: # noqa: D
pass
2 changes: 1 addition & 1 deletion dbt_semantic_interfaces/protocols/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any, Dict, Protocol


class PydanticSemanticLayerElementConfig(Protocol): # noqa: D
class SemanticLayerElementConfig(Protocol): # noqa: D
"""The config property allows you to configure additional resources/metadata."""

@property
Expand Down
10 changes: 5 additions & 5 deletions tests/test_implements_satisfy_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from hypothesis.strategies import booleans, builds, from_type, just, lists, none, text

from dbt_semantic_interfaces.implementations.element_config import (
SemanticLayerElementConfig,
PydanticSemanticLayerElementConfig,
)
from dbt_semantic_interfaces.implementations.elements.dimension import (
PydanticDimension,
Expand Down Expand Up @@ -68,7 +68,7 @@
expr=OPTIONAL_STR_STRATEGY,
metadata=OPTIONAL_METADATA_STRATEGY,
label=OPTIONAL_STR_STRATEGY,
config=builds(SemanticLayerElementConfig),
config=builds(PydanticSemanticLayerElementConfig),
)

DIMENSION_VALIDITY_PARAMS_STRATEGY = builds(
Expand All @@ -85,7 +85,7 @@
expr=OPTIONAL_STR_STRATEGY,
metadata=OPTIONAL_METADATA_STRATEGY,
label=OPTIONAL_STR_STRATEGY,
config=builds(SemanticLayerElementConfig),
config=builds(PydanticSemanticLayerElementConfig),
)

DIMENSION_STRATEGY = TIME_DIMENSION_STRATEGY | CATEGORICAL_DIMENSION_STRATEGY
Expand All @@ -97,7 +97,7 @@
expr=OPTIONAL_STR_STRATEGY,
metadata=OPTIONAL_METADATA_STRATEGY,
label=OPTIONAL_STR_STRATEGY,
config=builds(SemanticLayerElementConfig),
config=builds(PydanticSemanticLayerElementConfig),
)

MEASURE_STRATEGY = builds(
Expand All @@ -109,7 +109,7 @@
non_additive_dimesnion=builds(PydanticNonAdditiveDimensionParameters) | none(),
agg_time_dimension=OPTIONAL_STR_STRATEGY,
label=OPTIONAL_STR_STRATEGY,
config=builds(SemanticLayerElementConfig),
config=builds(PydanticSemanticLayerElementConfig),
)

SEMANTIC_MODEL_STRATEGY = builds(
Expand Down

0 comments on commit 41a22dd

Please sign in to comment.