Skip to content
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

[FEATURE] Set all macro namespace by default to ['<name_of_your_root_project>', '<macro_namespace>'] #4106

Closed
JCZuurmond opened this issue Oct 21, 2021 · 0 comments · Fixed by #4114
Labels
good_first_issue Straightforward + self-contained changes, good for new contributors! regression
Milestone

Comments

@JCZuurmond
Copy link
Contributor

As suggested by @jtcohen6 in comment, change this

if not search_packages and namespace in self._adapter.config.dependencies:
search_packages = [namespace]

to:

            if not search_packages and namespace in self._adapter.config.dependencies:
                search_packages = [self.config.project_name, namespace]

With this change, by default we prefer macro overwrites for packages (like spark__create_table_as) defined in the root project over the ones defined in the package. The user can change the preference behavior by defining the search order explicitly:

# dbt_project.yml
dispatch:
  - macro_namespace: dbt
    search_order: ['<package name>, '<root project name>']

In the old behavior the macros for packages in the root folder are not preferred over the ones in the packages, needing the user to explicitly set the search order to:

# dbt_project.yml
dispatch:
  - macro_namespace: dbt
    search_order: ['<root project name', '<package name>]

We think that the proposed change is a more sensible default.

@jtcohen6 jtcohen6 added good_first_issue Straightforward + self-contained changes, good for new contributors! regression labels Oct 21, 2021
@jtcohen6 jtcohen6 added this to the 0.21.1 milestone Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good_first_issue Straightforward + self-contained changes, good for new contributors! regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants