diff --git a/dbt_semantic_interfaces/implementations/project_configuration.py b/dbt_semantic_interfaces/implementations/project_configuration.py index 1be46fcf..4617ae02 100644 --- a/dbt_semantic_interfaces/implementations/project_configuration.py +++ b/dbt_semantic_interfaces/implementations/project_configuration.py @@ -14,9 +14,7 @@ UNKNOWN_VERSION_SENTINEL, PydanticSemanticVersion, ) -from dbt_semantic_interfaces.implementations.time_spine_table_configuration import ( - PydanticTimeSpineTableConfiguration, -) +from dbt_semantic_interfaces.implementations.time_spine import PydanticTimeSpine from dbt_semantic_interfaces.protocols import ProtocolHint from dbt_semantic_interfaces.protocols.project_configuration import ProjectConfiguration from dsi_pydantic_shim import validator @@ -29,7 +27,7 @@ class PydanticProjectConfiguration(HashableBaseModel, ModelWithMetadataParsing, def _implements_protocol(self) -> ProjectConfiguration: return self - time_spine_table_configurations: List[PydanticTimeSpineTableConfiguration] + time_spine_table_configurations: List[PydanticTimeSpine] metadata: Optional[PydanticMetadata] = None dsi_package_version: PydanticSemanticVersion = UNKNOWN_VERSION_SENTINEL diff --git a/dbt_semantic_interfaces/implementations/time_spine_table_configuration.py b/dbt_semantic_interfaces/implementations/time_spine.py similarity index 60% rename from dbt_semantic_interfaces/implementations/time_spine_table_configuration.py rename to dbt_semantic_interfaces/implementations/time_spine.py index 9bab71f8..8a8bafee 100644 --- a/dbt_semantic_interfaces/implementations/time_spine_table_configuration.py +++ b/dbt_semantic_interfaces/implementations/time_spine.py @@ -7,19 +7,17 @@ ModelWithMetadataParsing, ) from dbt_semantic_interfaces.protocols import ProtocolHint -from dbt_semantic_interfaces.protocols.time_spine_configuration import ( - TimeSpineTableConfiguration, +from dbt_semantic_interfaces.protocols.time_spine import ( + TimeSpine, ) from dbt_semantic_interfaces.type_enums import TimeGranularity -class PydanticTimeSpineTableConfiguration( - HashableBaseModel, ModelWithMetadataParsing, ProtocolHint[TimeSpineTableConfiguration] -): +class PydanticTimeSpine(HashableBaseModel, ModelWithMetadataParsing, ProtocolHint[TimeSpine]): """Pydantic implementation of SemanticVersion.""" @override - def _implements_protocol(self) -> TimeSpineTableConfiguration: + def _implements_protocol(self) -> TimeSpine: return self location: str diff --git a/dbt_semantic_interfaces/protocols/project_configuration.py b/dbt_semantic_interfaces/protocols/project_configuration.py index e2248bb3..da4746da 100644 --- a/dbt_semantic_interfaces/protocols/project_configuration.py +++ b/dbt_semantic_interfaces/protocols/project_configuration.py @@ -2,9 +2,7 @@ from typing import Protocol, Sequence from dbt_semantic_interfaces.protocols.semantic_version import SemanticVersion -from dbt_semantic_interfaces.protocols.time_spine_configuration import ( - TimeSpineTableConfiguration, -) +from dbt_semantic_interfaces.protocols.time_spine import TimeSpine class ProjectConfiguration(Protocol): @@ -18,6 +16,6 @@ def dsi_package_version(self) -> SemanticVersion: @property @abstractmethod - def time_spine_table_configurations(self) -> Sequence[TimeSpineTableConfiguration]: + def time_spine_table_configurations(self) -> Sequence[TimeSpine]: """The time spine table configurations. Multiple allowed for different time grains.""" pass diff --git a/dbt_semantic_interfaces/protocols/time_spine_configuration.py b/dbt_semantic_interfaces/protocols/time_spine.py similarity index 95% rename from dbt_semantic_interfaces/protocols/time_spine_configuration.py rename to dbt_semantic_interfaces/protocols/time_spine.py index de0579a7..209bd2f5 100644 --- a/dbt_semantic_interfaces/protocols/time_spine_configuration.py +++ b/dbt_semantic_interfaces/protocols/time_spine.py @@ -4,7 +4,7 @@ from dbt_semantic_interfaces.type_enums import TimeGranularity -class TimeSpineTableConfiguration(Protocol): +class TimeSpine(Protocol): """Describes the configuration for a time spine table. A time spine table is a table with a single column containing dates at a specific grain. diff --git a/tests/example_project_configuration.py b/tests/example_project_configuration.py index b7cd99aa..41f6d4ad 100644 --- a/tests/example_project_configuration.py +++ b/tests/example_project_configuration.py @@ -3,15 +3,13 @@ from dbt_semantic_interfaces.implementations.project_configuration import ( PydanticProjectConfiguration, ) -from dbt_semantic_interfaces.implementations.time_spine_table_configuration import ( - PydanticTimeSpineTableConfiguration, -) +from dbt_semantic_interfaces.implementations.time_spine import PydanticTimeSpine from dbt_semantic_interfaces.parsing.objects import YamlConfigFile from dbt_semantic_interfaces.type_enums import TimeGranularity EXAMPLE_PROJECT_CONFIGURATION = PydanticProjectConfiguration( time_spine_table_configurations=[ - PydanticTimeSpineTableConfiguration( + PydanticTimeSpine( location="example_schema.example_table", column_name="ds", grain=TimeGranularity.DAY, diff --git a/tests/test_implements_satisfy_protocols.py b/tests/test_implements_satisfy_protocols.py index 44b34a3b..f369f82b 100644 --- a/tests/test_implements_satisfy_protocols.py +++ b/tests/test_implements_satisfy_protocols.py @@ -35,9 +35,7 @@ PydanticSemanticManifest, ) from dbt_semantic_interfaces.implementations.semantic_model import PydanticSemanticModel -from dbt_semantic_interfaces.implementations.time_spine_table_configuration import ( - PydanticTimeSpineTableConfiguration, -) +from dbt_semantic_interfaces.implementations.time_spine import PydanticTimeSpine from dbt_semantic_interfaces.protocols import Dimension as DimensionProtocol from dbt_semantic_interfaces.protocols import Entity as EntityProtocol from dbt_semantic_interfaces.protocols import Measure as MeasureProtocol @@ -48,9 +46,7 @@ SemanticManifest as SemanticManifestProtocol, ) from dbt_semantic_interfaces.protocols import SemanticModel as SemanticModelProtocol -from dbt_semantic_interfaces.protocols.time_spine_configuration import ( - TimeSpineTableConfiguration as TimeSpineTableConfigurationProtocol, -) +from dbt_semantic_interfaces.protocols.time_spine import TimeSpine as TimeSpineProtocol from dbt_semantic_interfaces.type_enums import DimensionType, MetricType OPTIONAL_STR_STRATEGY = text() | none() @@ -284,12 +280,12 @@ def test_saved_query_protocol(saved_query: PydanticSavedQuery) -> None: # noqa: @runtime_checkable -class RuntimeCheckableTimeSpineConfiguration(TimeSpineTableConfigurationProtocol, Protocol): +class RuntimeCheckableTimeSpineConfiguration(TimeSpineProtocol, Protocol): """We don't want runtime_checkable versions of protocols in the package, but we want them for tests.""" pass -@given(builds(PydanticTimeSpineTableConfiguration)) -def test_time_spine_table_configuration_protocol(time_spine: PydanticTimeSpineTableConfiguration) -> None: # noqa: D +@given(builds(PydanticTimeSpine)) +def test_time_spine_table_configuration_protocol(time_spine: PydanticTimeSpine) -> None: # noqa: D assert isinstance(time_spine, RuntimeCheckableTimeSpineConfiguration)