-
Notifications
You must be signed in to change notification settings - Fork 17
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
Allow same names for dimensions and time dimension groups in generated views #1010
Conversation
d972d4c
to
e897c0d
Compare
and not (name == "event" and dimension["type"] == "time") | ||
# workaround for `mozdata.firefox_desktop.desktop_installs` | ||
and not (name == "attribution_dltoken" and dimension["type"] == "time") |
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.
We no longer need these workarounds now.
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.
r+wc
I appreciate you being willing to pivot to this alternate approach after having already coded your original approach.
generator/views/lookml_utils.py
Outdated
and dimension["name"] != "submission" | ||
and not dimension["name"].endswith("end") | ||
and not dimension["name"].endswith("start") |
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.
Same here.
It seems like it'd be good to refactor this repeated logic in _generate_dimensions
and _generate_dimensions_from_query
out into a separate function named something like _generate_dimensions_from_schema
. The only catch is the exception messages for duplicate dimensions are different, and in _generate_dimensions
it does helpfully include the table in the error message, but for that case you could probably wrap the _generate_dimensions_from_schema
call in a try/catch and do something like
raise click.ClickException(f"Error generating dimensions for table {table!r}") from e
Alternative to #1007 that would fix mozilla/bigquery-etl#5903, implements suggestion from #1007 (comment).
This approach seems to be minimally invasive and generalized, without hardcoding table names, allowing to unblock mozilla/bigquery-etl#5903.