-
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
Use helper function to find matching instances in dataset #1538
Conversation
time_dimension_spec: TimeDimensionSpec, | ||
) -> ColumnAssociation: | ||
"""Given the name of the time dimension, return the set of columns associated with it in the data set.""" | ||
def instances_for_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.
The pluralized version of this is not currently used but will be used further up the stack.
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 but see comment.
metricflow/dataset/sql_dataset.py
Outdated
return column_associations_to_return[0] | ||
def instance_for_time_dimension(self, time_dimension_spec: TimeDimensionSpec) -> TimeDimensionInstance: | ||
"""Given the name of the time dimension, return the instance associated with it in the data set.""" | ||
return self.instances_for_time_dimensions((time_dimension_spec,))[0] |
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.
A check / error message for the number of instances returned by instances_for_time_dimensions
would be helpful here.
Clean up. Just reducing some repeated code in dataflow to SQL logic.
Clean up. Just reducing some repeated code in dataflow to SQL logic.