dbt - Jinja in dbtYou want to create a shared macro library for multiple dbt projects. Which steps correctly set this up?ACopy macros folder into each project manuallyBCreate a separate dbt project with macros, publish it, add as dependency in other projectsCDefine macros in each project with the same name and codeDUse ref() to call macros from other projectsCheck Answer
Step-by-Step SolutionSolution:Step 1: Create shared macro projectMake a separate dbt project containing only macros you want to share.Step 2: Add as dependencyPublish this project and add it as a dependency in other projects via packages.yml.Step 3: Call macros by project nameUse the project namespace to call macros from the shared library.Final Answer:Create a separate dbt project with macros, publish it, add as dependency in other projects -> Option BQuick Check:Shared macro library = separate project + dependency [OK]Quick Trick: Use a separate project and dependencies for shared macros [OK]Common Mistakes:MISTAKESCopying macros manually causes duplicationDefining same macros in multiple projectsUsing ref() for macros instead of models
Master "Jinja in dbt" in dbt9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More dbt Quizzes Incremental Models - Handling late-arriving data - Quiz 7medium Incremental Models - Full refresh vs incremental - Quiz 7medium Incremental Models - Why incremental models save time and cost - Quiz 11easy Incremental Models - Incremental strategies (append, merge, delete+insert) - Quiz 4medium Jinja in dbt - if/else logic in models - Quiz 6medium Jinja in dbt - if/else logic in models - Quiz 14medium Packages and Reusability - Installing packages with packages.yml - Quiz 14medium Project Organization - One model per source table rule - Quiz 14medium Project Organization - dbt_project.yml configuration - Quiz 8hard Project Organization - One model per source table rule - Quiz 15hard