-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
feat(sqla): apply time grain to all temporal groupbys #16318
Conversation
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 really useful feature for the time column.
@villebro this seems like a breaking change and thus my sense is it should be behind a feature flag. Note I understand the use case but it could be seen as a regression in terms of UX, i.e., it's not apparent to the user that the group-by temporal columns are also subject to the granularity which historically only applies to the temporal column. Also as you mentioned there may be existing cases which this pattern breaks—like when the time grains need to be decoupled. An alternative approach—which requires more user work and isn't as dynamic—is to add custom columns which are granularity specific or have a mechanism to choose which columns the granularity (which really is a transformation) applies to. |
Also @villebro this breaks the logic in
|
This reverts commit 9075e42.
SUMMARY
Currently the time grain only applies to the main temporal column, making it impossible to have multiple time grained groupbys in the same chart. This PR changes the SqlAlchemy model to apply the time grain to all selected temporal columns. By applying this change it will no longer be possible to mix time grains and original values from two different temporal columns. However, it is unlikely that anyone would prefer that behavior over the proposed new flow, given that in the old flow it was impossible to apply a time grain to other than the main temporal column.
AFTER
Table chart:
Pivot table v2:
BEFORE
Table chart:
Pivot table v2:
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION