-
Notifications
You must be signed in to change notification settings - Fork 100
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
Methods to look up agg_time_dimensions
#995
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
linkable_element_sets_to_merge.append( | ||
ValidLinkableSpecResolver._get_elements_in_semantic_model(semantic_model) | ||
) | ||
linkable_element_sets_to_merge.append(self._get_elements_in_semantic_model(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.
Changes in this file were made to avoid a circular import.
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.
Makes sense!
agg_time_dimensions
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.
Seems reasonable! Can we add some test cases for the new methods before merge? The tests for these classes seem to live in metricflow/test/model/test_semantic_model_container.py
so we should be able to add a few cases pretty easily.
linkable_element_sets_to_merge.append( | ||
ValidLinkableSpecResolver._get_elements_in_semantic_model(semantic_model) | ||
) | ||
linkable_element_sets_to_merge.append(self._get_elements_in_semantic_model(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.
Makes sense!
@@ -300,14 +301,12 @@ def _resolved_primary_entity(semantic_model: SemanticModel) -> Optional[EntityRe | |||
) | |||
|
|||
# This should be caught by the validation, but adding a sanity check. | |||
assert len(entities_with_type_primary) <= 1, f"Found >1 primary entity in {semantic_model}" | |||
assert len(entities_with_type_primary) <= 1, f"Found > 1 primary entity in {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.
spaaaaaaaaace!
entity_link = self.resolved_primary_entity(semantic_model) | ||
assert ( | ||
entity_link is not None | ||
), f"Expected semantic model {semantic_model} to have a primary entity since is contains dimensions, but found none." |
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.
Ok, this is implicit, right? We know it contains a measure, which means it must have an agg_time_dimension, which means it has at least a time dimension.
Maybe update the message to to have a primary entity since it has a measure requiring an agg_time_dimension
?
Regardless, micro-nit - it
not is
.
Description
Adds some methods that will be used to enable querying with
agg_time_dimension
instead ofmetric_time
.MetricLookup.get_valid_agg_time_dimensions_for_metric()
will be used in validations, whileSemanticModelLookup.get_agg_time_dimension_specs_for_measure()
will be used in query building.