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

DBT 0.21.0 requires new configuration to override global DBT macros #1

Open
mroy-seedbox opened this issue Nov 5, 2021 · 11 comments
Open

Comments

@mroy-seedbox
Copy link

See https://docs.getdbt.com/reference/dbt-jinja-functions/dispatch#overriding-global-macros

dispatch:
  - macro_namespace: dbt
    search_order: ['my_project/my_package', 'dbt']
@AdrianCio
Copy link

@mroy-seedbox did you get this to work? I'm struggling with this

@mroy-seedbox
Copy link
Author

Yup, all you need is something like this in your dbt_project.yml:

name: my_project

# Allow my macros to override global DBT macros
dispatch:
  - macro_namespace: dbt
    search_order: ['my_project', 'dbt']

@AdrianCio
Copy link

This is strange, I did this but it gives me No materialization 'plain' was found for adapter postgres! (searched types 'default' and 'postgres')

@mroy-seedbox
Copy link
Author

That is weird indeed! But I've never tested it with Postgres (only with Snowflake)... maybe there's something missing to make it work? 🤔

@mroy-seedbox
Copy link
Author

mroy-seedbox commented Aug 29, 2024

Try with something like this:

# Allow my macros & DDO macros to override global DBT macros
dispatch:
  - macro_namespace: dbt
    search_order: ['my_project', 'dbt_packages/DDO/macros', 'dbt']

@AdrianCio
Copy link

Same issue :(

macro-paths: 
  - "macros"
  - dbt_modules/DDO/macros/materializations

# Allow my macros & DDO macros to override global DBT macros
dispatch:
  - macro_namespace: dbt
    search_order: ['my_project', 'dbt_modules/DDO/macros', 'dbt']

@mroy-seedbox
Copy link
Author

Try with dbt_packages/ instead of dbt_modules/.

dbt_modules/ was for older versions of DBT.

@AdrianCio
Copy link

Same result with this config. It is a good point that I was using the old name, but unfortunately it didn't change the output.
I also ran a quick test where I removed dbt_packages from clean-targets but again, same result as in my previous post.

macro-paths: 
  - "macros"
  - dbt_packages/DDO/macros/materializations

# Allow my macros & DDO macros to override global DBT macros
dispatch:
  - macro_namespace: dbt
    search_order: ['my_project', 'dbt_packages/DDO/macros', 'dbt']

target-path: "target"  # directory which will store compiled SQL files
clean-targets:         # directories to be removed by `dbt clean`
  - "target"
  - "dbt_packages"

@mroy-seedbox
Copy link
Author

Have you tried creating a copy of the materialization in your own project?

If that doesn't work, then it must be something specific to do with the DBT Postgres implementation. 😕

@mroy-seedbox
Copy link
Author

@AdrianCio: did it work? 😅

@AdrianCio
Copy link

Apologies, I was off for a week. Indeed I ended up copying the materialization in my project which works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants