-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Specify macro_namespace of global_project dispatch macros #3851
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.
This feels like it ought to have always worked this way. LGTM!
Steps to evaluate a feature branchReally struggled to Turns out I had to git clone the repo locally, checkout the branch then:
Then in my target toy dbt project:
Current issue evaluating featureSo I finally got our Error output:
Does that make sense? I admit this is likely something trivial in the dbt ecosystem I am missing and nothing to do with the specifics of this PR. Test strategyMy testing strategy to check our custom package is overriding the global macros for naming databases and schemas is to just run a |
Following up, I got it working by name spacing calls to the internal macros with the name of the package. Eg I thought it was something simple on my end. This looks good to use immediately for our use case. 👍 |
343402a
to
869f0fb
Compare
For what it is worth, rolled this out to 9 projects. |
Just following up here to save time explaining the context of the feature/bug I am experiencing before opening an issue where I have to repeat the context.
dispatch:
- macro_namespace: dbt
search_order: ['dbt_sample', 'my_macro_package', 'dbt'] But because I refactored all of my macros into So the above config gives the following error message:
The only workaround I can see is to change it to the following if the root project has no macros: dispatch:
- macro_namespace: dbt
search_order: ['my_macro_package', 'dbt'] I'm not a huge fan of having to change preference config to match the existence of filesystem content. Feels like an opportunity for automation instead of manually twizzling config to suit. If it is already reported and being addressed, a nudge to the existing issue would be appreciated so I can follow. |
@jpeak-intellify Appreciate you putting the comment here! I think we made a semi-related change that will incidentally fix this (#4114), by catching the mid-dispatch We've backported that fix for v0.21.1, which is currently available as a release candidate. Could you take that for a spin, and see if it resolves the issue?
(where |
Love your work. Yeah that nailed the issue. 👏 |
resolves #3456
Fuller description in the issue. Big idea is, you can reimplement a built-in global macro (including your adapter's built-in version) with a version that's defined in a package.
I think this just works for existing functionality. I'll create some tests for the net-new functionality described above.
Following the conversation in #3830, I also added dispatching for
generate_schema_name
andgenerate_alias_name
. Funny enough,generate_database_name
was already dispatched.This wasn't on our v1.0 list, but it feels quite 1.0-y, so I'd be excited to get it in before then.
Checklist
CHANGELOG.md
and added information about my change to the "dbt next" section.