-
Notifications
You must be signed in to change notification settings - Fork 14
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
Switch from checked_agg_time_dimension
to checked_agg_time_dimension_for_measure
#113
Conversation
…col and implementation Since we're removing `checked_agg_time_dimension` from `Measures`, it makes it easier for others to transition if we provide a new method at the appropriate level instead of requiring them to implement it themselves.
…cked_agg_time_dimension_for_measure`
…ion_for_measure` Note: This rule seems very similar to `MeasuresNonAdditiveDimensionRule` maybe we can deduplicate these slightly in the future.
It essentialy the same as the `AggregationTimeDimensionRule`, but only giving a warning.
We no longer require the `agg_time_dimension` of a `Measure` be set, thus this rule is obsolete
The `agg_time_dimension` is no longer required for measures. It's only required if the measure's parent `SemanticModel` doesn't have a `defaults.agg_time_dimension` set
…_dimension` not being required on measures
9ad1ee9
to
88de482
Compare
checked_agg_time_dimension
to checked_agg_time_dimension_for_measure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM aside from comment.
@@ -167,3 +169,15 @@ def get_entity(self, entity_reference: LinkableElementReference) -> PydanticEnti | |||
return entity | |||
|
|||
raise ValueError(f"No entity with name ({entity_reference}) in semantic_model with name ({self.name})") | |||
|
|||
def checked_agg_time_dimension_for_measure(self, measure: Measure): # noqa: D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of the measure object, using a measure reference seems more robust since this only applies to measures from this semantic model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Doing so adds the guarantee that the measure can be found on the semantic model, which is nice. It's unfortunate that everywhere where we currently call checked_agg_time_dimension
in MetricFlow
and dbt-semantic-interfaces
(and will be now calling checked_agg_time_dimension_for_measure
) we already have the full measure object. So we'll be invoking another list iteration even though we don't have to. If that ever becomes an actual issue though, we'll know where to look.
…asureReference` Previously we were taking in a fully realized `Measure` object as a parameter to `checked_agg_time_dimension_for_measure`. By switching to taking in only a `MeasureReference` the function now guarantees that the referenced `Measure` belongs to the `SemanticModel`. This has the unfortunate side affect of preforming an additional list based lookup, but if this ever becomes an issue, we'll know what we can do.
Resolves #None
Description
The
agg_time_dimension
of a measure isOptional
, but we were only have treating it as such. @tlento's change in #101 was the first wave of this change. This proliferates the change fully thought DSI.Checklist
changie new
to create a changelog entry