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

Default granularity bug fix: handle time dimensions with the same name #305

Merged
merged 4 commits into from
Jul 3, 2024

Conversation

courtneyholcomb
Copy link
Contributor

@courtneyholcomb courtneyholcomb commented Jul 3, 2024

Description

Found another bug in SetDefaultGranularityRule. If there are multiple agg_time_dimensions with the same name across semantic models, and they have different granularities, we'll only check one. Fixed here!

Checklist

@@ -34,7 +38,7 @@ def transform_model(semantic_manifest: PydanticSemanticManifest) -> PydanticSema
continue

default_granularity = TimeGranularity.DAY
seen_agg_time_dimensions: Set[TimeDimensionReference] = set()
seen_agg_time_dimensions: Set[Tuple[SemanticModel, TimeDimensionReference]] = set()
Copy link
Contributor

Choose a reason for hiding this comment

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

Im always wary of using larger objects in sets, so if we could change this to like a semanticmodelreference would be nice

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call

@@ -49,11 +53,16 @@ def transform_model(semantic_manifest: PydanticSemanticManifest) -> PydanticSema
except AssertionError:
# This indicates the agg_time_dimension is misconfigured, which will fail elsewhere.
# Do nothing here to avoid disrupting the validation process.
logger.warning(
f"Agg time dimension '{agg_time_dimension_ref.element_name}' not found in model."
"This should raise a validation error elsewhere."
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is it supposed to raise a validation error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ValidationError(
context=measure_context,

@@ -1,6 +1,6 @@
[project]
name = "dbt-semantic-interfaces"
version = "0.6.3"
version = "0.6.4"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you move this to a separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shoot, sorry got Will's approval and merged before I got this 😅

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 have seen some people request separate PRs for these bumps, but I just find that it slows down development. What's your thought process on why we should separate them?

@courtneyholcomb courtneyholcomb merged commit 49a0347 into main Jul 3, 2024
22 checks passed
@courtneyholcomb courtneyholcomb deleted the court/bug-fix-default branch July 3, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants