-
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
Add flags.deprecate_package_materialization_builtin_override #9956
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9956 +/- ##
==========================================
- Coverage 88.17% 88.14% -0.03%
==========================================
Files 181 181
Lines 22614 22625 +11
==========================================
+ Hits 19939 19943 +4
- Misses 2675 2682 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -355,7 +355,7 @@ def set_common_global_flags(self): | |||
# This is here to prevent mypy from complaining about all of the | |||
# attributes which we added dynamically. | |||
def __getattr__(self, name: str) -> Any: | |||
return super().__get_attribute__(name) # type: ignore | |||
return super().__getattribute__(name) # type: ignore |
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 appears to have been broken all along, but was never reached in testing
) | ||
else: | ||
materialization_candidate = candidates.last_candidate( | ||
valid_localities=[Locality.Core, Locality.Root] |
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.
was not able to do this lower-level using the _find_macros_by_name
filter
parameter because that filter only has a view of the macro candidate being iterated over. For this check, we need to exclude imported materialization macros only if the materialization is builtin in order to continue supporting custom materializations from packages (tested)
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.
Looks good - just a changelog comment.
codecov/project is hanging waiting for a response but I can see the results passing on: https://app.codecov.io/gh/dbt-labs/dbt-core/pull/9956 |
resolves #10007
Problem
Materializations defined in third-party packages are included in the search order for materialization macros. This is difficult to detect, difficult to prevent, and it works differently from other macros.
We should remove third-party packages from the search order.
This change needs to go behind a behavior-change flag:Legacy behaviors | dbt Developer Hub . See #9366 for an implementation of a behavior-change flag.
Solution
Introduce flags.deprecate_package_materialization_builtin_override.
when the flag is False (legacy behaviour):
when the flag is True (soon-to-be default behaviour)
Checklist