-
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 adapter macro namespacing (#2548) #2590
Conversation
adapter_types -> plugins Use factory.packages instead of global PACKAGES
consolidate dbt.ui, move non-rpc node_runners into their tasks move parse_cli_vars into config.utils get rid of logger/exceptions requirements in dbt.utils
Moved some relation logic out of adapters and into contracts Fixed a typo in a type name Fixed an issue where tests could fail based on color settings Fixed the type analysis for adapter plugins/factory Swapped more concrete tyeps out for protocols Finally removed PACKAGES global Added unit tests
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.
Nice, the ordering and hierarchy logic looks to me. Approved on my end
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 didn't spend too much time looking at the diff, so I'll defer to @kwigley on that front. I did test this out locally, and everything appeared to work as expected. LGTM!
It's not clear to me why I have to do this, but: @cla-bot check |
The cla-bot has been summoned, and re-checked this pull request! |
resolves #2548
Description
Fix adapter macros so they can override core (and one another) in consistent ways.
Generally, macros from plugins that aren't actively in use are no longer available, and macros follow a name resolution hieirarchy within
dbt
: dbt-global-project macros have a lower precedence than dependency plugins have a lower precedence than the current plugin. If the adapter type is unknown, dbt loads all the plugins it knows about in an undefined order, except that the internal global project is guaranteed to have the lowest priority.To make this effective without doing tons of imports inside functions/methods, I had to refactor a bit. Some functions moved out of
dbt.utils
to remove its dependencies, and some base type definitions moved fromadapters
intocontracts
. I also (finally) moved node runners into their non-rpc tasks, which allowed me to move some common logic intodbt.task
, and consolidateddbt.ui.*
into a singledbt.ui
.Most of these changes are rewritten imports and files moved. The changes that require the most attention are the changes to
adapter/factory.py
(plugin loading, path determination) andcontext/configured.py
(macro resolution)This does not convert
adapter_macro
into a python function, but I think it should make it unnecessary.Checklist
CHANGELOG.md
and added information about my change to the "dbt next" section.