-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Behavior change cumulative type param #10909
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10909 +/- ##
==========================================
- Coverage 89.07% 89.06% -0.01%
==========================================
Files 183 183
Lines 23550 23580 +30
==========================================
+ Hits 20976 21002 +26
- Misses 2574 2578 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
c6ac260
to
6da0bc6
Compare
2071399
to
92b6954
Compare
113c63a
to
02d1902
Compare
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.
This change looks good to me except for one behavior. Also thanks for enumerate the tests you did in the PR description!
- I would expect when you set
require_nested_cumulative_type_params
, the warning from usingunnested param
would be an error. Since now user is required to set that param in nested fashion
@ChenyuLInx So, this follows other behavior changes like here by using a warning message, not an error message. Since the legacy behavior is still supported, I think it makes sense to keep as a warning. The message is to notify to the user to upgrade their legacy yaml spec, not to indicate that there was a failure during invocation. |
The case there is if you change the flag to true, the warning will be gone, but dbt will actually behave differently(change the macro overwrite order). The changing behavior part is an important piece of this flag. |
We talked on Slack, and @DevonFulcher is going to change the behavior to failure if the schema is not adjusted but the flag is flipped to true. |
), | ||
message=f"Cumulative metric {m} fields `type_params.window` and `type_params.grain_to_date` should be nested under `type_params.cumulative_type_params.window` and `type_params.cumulative_type_params.grain_to_date`. See documentation on behavior changes: https://docs.getdbt.com/reference/global-configs/behavior-changes.", | ||
) | ||
for m in metrics_using_old_params |
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.
Can we update this to be just one error that lists all the metrics with deprecated fields? We previously had complaints from customers about this because it was extremely noisy to have a warning for each metric.
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.
One suggestion but otherwise LGTM! Thank you!
def code(self) -> str: | ||
return "D019" | ||
|
||
def message(self) -> str: |
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.
Would it be easy to add the names of the outdated metrics in this message? Otherwise it might be hard for users to find.
But if that doesn't work with the behavior change objects easily, it probably isn't worth it.
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.
Ya, I don't think that is a straightforward change, given that it would change the interface. I think that could be an enhancement in the future.
[Edited after my last commit]
Resolves #10960
Linear issue: SL-2935
docs: dbt-labs/docs.getdbt.com#6393
Problem & Solution
The type params for cumulative metrics have moved, so a behavior change needs to be implemented to surface this for users. This is what the warning looks like:
Here is what the error looks like when the user flips the behavior flag:
Testing:
dbt parse
injaffle-sl-template
and I saw the warning message due to this metric defined there:dbt_project.yaml
, and saw the error message and thatdbt parse
failed:Checklist