Bird
0
0

You want to create a shared macro library for multiple dbt projects. Which steps correctly set this up?

hard📝 Application Q8 of 15
dbt - Jinja in dbt
You want to create a shared macro library for multiple dbt projects. Which steps correctly set this up?
ACopy macros folder into each project manually
BCreate a separate dbt project with macros, publish it, add as dependency in other projects
CDefine macros in each project with the same name and code
DUse ref() to call macros from other projects
Step-by-Step Solution
Solution:
  1. Step 1: Create shared macro project

    Make a separate dbt project containing only macros you want to share.
  2. Step 2: Add as dependency

    Publish this project and add it as a dependency in other projects via packages.yml.
  3. Step 3: Call macros by project name

    Use the project namespace to call macros from the shared library.
  4. Final Answer:

    Create a separate dbt project with macros, publish it, add as dependency in other projects -> Option B
  5. Quick Check:

    Shared macro library = separate project + dependency [OK]
Quick Trick: Use a separate project and dependencies for shared macros [OK]
Common Mistakes:
MISTAKES
  • Copying macros manually causes duplication
  • Defining same macros in multiple projects
  • Using ref() for macros instead of models

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes