-
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
Fix #8031: Call materialization macro from adapter dispatch #8355
Conversation
Codecov Report
@@ Coverage Diff @@
## main dbt-labs/dbt-core#8355 +/- ##
==========================================
- Coverage 86.36% 86.36% -0.01%
==========================================
Files 174 174
Lines 25575 25580 +5
==========================================
+ Hits 22089 22093 +4
- Misses 3486 3487 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
🎩 (same behavior)
|
Pretty simple so far, and glad that it's working. Now that those basics are in, there are a few things to look at doing... You should use the same type of context.adapter.dispatch call in the run task, and look for breakage. @jtcohen6 was interested in allowing the same naming convention for materialization macros that we use for other macros, for ease of overriding. Right now we can't override easily. That's the naming convention that starts with the adapter, like "postgres__drop_schema". You should attempt to allow both forms of materialization naming and get them to work, with the "<adapter_name>__" style name overriding the earlier format. I suspect that when we use context.adapter.dispatch in the run task we'll get breakage due to the special context that's used by the code that detects where the python code is being called from. You'll probably need to set that where the MacroGenerator objects are created. |
All existing tests are passing, here are the next steps:
|
attempts.append(f"{package_name}.{search_name}") | ||
|
||
if macro is not None: | ||
if macro_name.startswith("materialization_"): |
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.
I think we made a fix recently for scenarios where macros that started with "materialization_" were incorrectly being picked up as materializations. For example, this was being flagged as a materialization instead of a macro:
{% macro materialization_setup() %}
...
{% endmacro %}
Have you verified this doesn't reintroduce that issue?
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 have tests for that case now, so this PR shouldn't reintroduce the issue (or if it does, it'll be obvious before merging).
Closing this PR per discussion with @mikealfare, creating new ticket to migrate |
resolves #8031
docs dbt-labs/docs.getdbt.com/#
Problem
Solution
Checklist