Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy time spine warning message #353

Merged
merged 3 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20241007-160153.yaml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 1 addition & 14 deletions dbt_semantic_interfaces/validations/time_spines.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
33 changes: 0 additions & 33 deletions tests/validations/test_time_spines.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could keep this test but update this to say assert len(issues.warnings) == 1 and remove the line below!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you mean assert len(issues.warnings) == 0, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes 😆

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(
Expand Down
Loading