From 7d1e7880aa070c037d6403f7673b94d0c4d44f06 Mon Sep 17 00:00:00 2001 From: Devon Fulcher <24593113+DevonFulcher@users.noreply.github.com> Date: Mon, 7 Oct 2024 15:59:15 -0500 Subject: [PATCH 1/3] Remove legacy time spine warning --- .../validations/time_spines.py | 15 +-------- tests/validations/test_time_spines.py | 33 ------------------- 2 files changed, 1 insertion(+), 47 deletions(-) diff --git a/dbt_semantic_interfaces/validations/time_spines.py b/dbt_semantic_interfaces/validations/time_spines.py index df5110fb..002affe3 100644 --- a/dbt_semantic_interfaces/validations/time_spines.py +++ b/dbt_semantic_interfaces/validations/time_spines.py @@ -28,23 +28,10 @@ def validate_manifest(semantic_manifest: SemanticManifestT) -> Sequence[Validati if not semantic_manifest.semantic_models: return issues - time_spines = semantic_manifest.project_configuration.time_spines - if not time_spines: - docs_message = "See documentation to configure: https://docs.getdbt.com/docs/build/metricflow-time-spine" - # If they have the old time spine configured and need to migrate - if semantic_manifest.project_configuration.time_spine_table_configurations: - issues.append( - ValidationWarning( - message="Time spines without YAML configuration are in the process of deprecation. Please add " - "YAML configuration for your 'metricflow_time_spine' model. " + docs_message - ) - ) - return issues - # Verify that there is only one time spine per granularity time_spines_by_granularity: Dict[TimeGranularity, List[TimeSpine]] = {} granularities_with_multiple_time_spines: Set[TimeGranularity] = set() - for time_spine in time_spines: + for time_spine in semantic_manifest.project_configuration.time_spines: granularity = time_spine.primary_column.time_granularity if granularity in time_spines_by_granularity: time_spines_by_granularity[granularity].append(time_spine) diff --git a/tests/validations/test_time_spines.py b/tests/validations/test_time_spines.py index 822c41d7..7c0098d2 100644 --- a/tests/validations/test_time_spines.py +++ b/tests/validations/test_time_spines.py @@ -12,7 +12,6 @@ from dbt_semantic_interfaces.implementations.node_relation import PydanticNodeRelation from dbt_semantic_interfaces.implementations.project_configuration import ( PydanticProjectConfiguration, - PydanticTimeSpineTableConfiguration, ) from dbt_semantic_interfaces.implementations.semantic_manifest import ( PydanticSemanticManifest, @@ -75,38 +74,6 @@ def test_valid_time_spines() -> None: # noqa: D SemanticManifestValidator[PydanticSemanticManifest]().checked_validations(semantic_manifest) -def test_only_legacy_time_spine() -> None: # noqa: D - validator = SemanticManifestValidator[PydanticSemanticManifest]() - semantic_manifest = PydanticSemanticManifest( - semantic_models=[ - semantic_model_with_guaranteed_meta( - name="sum_measure", - measures=[ - PydanticMeasure(name="foo", agg=AggregationType.SUM, agg_time_dimension="dim", create_metric=True) - ], - dimensions=[ - PydanticDimension( - name="dim", - type=DimensionType.TIME, - type_params=PydanticDimensionTypeParams(time_granularity=TimeGranularity.SECOND), - ) - ], - entities=[PydanticEntity(name="entity", type=EntityType.PRIMARY)], - ), - ], - metrics=[], - project_configuration=PydanticProjectConfiguration( - time_spine_table_configurations=[ - PydanticTimeSpineTableConfiguration(location="hurrr", column_name="fun_col", grain=TimeGranularity.DAY) - ] - ), - ) - issues = validator.validate_semantic_manifest(semantic_manifest) - assert not issues.has_blocking_issues - assert len(issues.warnings) == 1 - assert "Time spines without YAML configuration are in the process of deprecation." in issues.warnings[0].message - - def test_duplicate_time_spine_granularity() -> None: # noqa: D validator = SemanticManifestValidator[PydanticSemanticManifest]() semantic_manifest = PydanticSemanticManifest( From 525e1b1d727e3770c33ecf94990e5886038749ce Mon Sep 17 00:00:00 2001 From: Devon Fulcher <24593113+DevonFulcher@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:01:57 -0500 Subject: [PATCH 2/3] changie --- .changes/unreleased/Under the Hood-20241007-160153.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Under the Hood-20241007-160153.yaml diff --git a/.changes/unreleased/Under the Hood-20241007-160153.yaml b/.changes/unreleased/Under the Hood-20241007-160153.yaml new file mode 100644 index 00000000..796f56f7 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20241007-160153.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: Remove legacy time spine warning message +time: 2024-10-07T16:01:53.142516-05:00 +custom: + Author: DevonFulcher + Issue: None From 4892e3bc774ae285766befa3ad3df007c66cbb76 Mon Sep 17 00:00:00 2001 From: Devon Fulcher <24593113+DevonFulcher@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:33:09 -0500 Subject: [PATCH 3/3] Added test back --- tests/validations/test_time_spines.py | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/validations/test_time_spines.py b/tests/validations/test_time_spines.py index 7c0098d2..70beba35 100644 --- a/tests/validations/test_time_spines.py +++ b/tests/validations/test_time_spines.py @@ -21,6 +21,9 @@ PydanticTimeSpineCustomGranularityColumn, PydanticTimeSpinePrimaryColumn, ) +from dbt_semantic_interfaces.implementations.time_spine_table_configuration import ( + PydanticTimeSpineTableConfiguration, +) from dbt_semantic_interfaces.test_utils import semantic_model_with_guaranteed_meta from dbt_semantic_interfaces.type_enums import ( AggregationType, @@ -74,6 +77,56 @@ def test_valid_time_spines() -> None: # noqa: D SemanticManifestValidator[PydanticSemanticManifest]().checked_validations(semantic_manifest) +def test_no_warning_for_legacy_time_spine() -> None: # noqa: D + validator = SemanticManifestValidator[PydanticSemanticManifest]() + semantic_manifest = PydanticSemanticManifest( + semantic_models=[ + semantic_model_with_guaranteed_meta( + name="sum_measure", + measures=[ + PydanticMeasure( + name="foo", + agg=AggregationType.SUM, + agg_time_dimension="dim", + create_metric=True, + description="", + agg_params=None, + metadata=None, + ) + ], + dimensions=[ + PydanticDimension( + name="dim", + type=DimensionType.TIME, + type_params=PydanticDimensionTypeParams(time_granularity=TimeGranularity.SECOND), + description="", + metadata=None, + ) + ], + entities=[ + PydanticEntity(name="entity", type=EntityType.PRIMARY, description="", role=None, metadata=None) + ], + ), + ], + metrics=[], + project_configuration=PydanticProjectConfiguration( + time_spine_table_configurations=[ + PydanticTimeSpineTableConfiguration(location="baz", column_name="fun_col", grain=TimeGranularity.DAY) + ], + time_spines=[ + PydanticTimeSpine( + node_relation=PydanticNodeRelation(alias="time_spine", schema_name="schema"), + primary_column=PydanticTimeSpinePrimaryColumn(name="ds", time_granularity=TimeGranularity.SECOND), + custom_granularities=[], + ) + ], + ), + ) + issues = validator.validate_semantic_manifest(semantic_manifest) + assert not issues.has_blocking_issues + assert len(issues.warnings) == 0 + + def test_duplicate_time_spine_granularity() -> None: # noqa: D validator = SemanticManifestValidator[PydanticSemanticManifest]() semantic_manifest = PydanticSemanticManifest(