Skip to content

Allow same names for dimensions and time dimension groups in generated views#1010

Merged
akkomar merged 3 commits intomainfrom
time_dimensions
Jul 17, 2024
Merged

Allow same names for dimensions and time dimension groups in generated views#1010
akkomar merged 3 commits intomainfrom
time_dimensions

Conversation

@akkomar
Copy link
Contributor

@akkomar akkomar commented Jul 16, 2024

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.

@akkomar akkomar force-pushed the time_dimensions branch 2 times, most recently from d972d4c to e897c0d Compare July 16, 2024 12:54
Comment on lines -129 to -131
and not (name == "event" and dimension["type"] == "time")
# workaround for `mozdata.firefox_desktop.desktop_installs`
and not (name == "attribution_dltoken" and dimension["type"] == "time")
Copy link
Contributor Author

@akkomar akkomar Jul 16, 2024

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.

@akkomar akkomar marked this pull request as ready for review July 16, 2024 13:18
@akkomar akkomar requested a review from sean-rose July 16, 2024 13:19
Copy link
Contributor

@sean-rose sean-rose left a 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.

Comment on lines 161 to 163
and dimension["name"] != "submission"
and not dimension["name"].endswith("end")
and not dimension["name"].endswith("start")
Copy link
Contributor

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

@akkomar akkomar merged commit 21fb9c4 into main Jul 17, 2024
@akkomar akkomar deleted the time_dimensions branch July 17, 2024 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

event column from events_stream inaccessible in Looker

2 participants