Recall & Review
beginner
What is a macro in dbt?
A macro in dbt is a reusable piece of code written in Jinja that helps automate repetitive tasks in your data transformations.
Click to reveal answer
beginner
How do you call a macro from another project in dbt?
You call a macro from another project by prefixing the macro name with the project name and a dot, like this:
{{ project_name.macro_name() }}.Click to reveal answer
intermediate
Why would you want to call macros across projects in dbt?
Calling macros across projects helps you reuse common logic and avoid duplication, making your code cleaner and easier to maintain.
Click to reveal answer
intermediate
What must be configured to enable calling macros across projects in dbt?
You must list the other project as a dependency in your
packages.yml file and run dbt deps to install it.Click to reveal answer
beginner
Example: How to call a macro named
calculate_metrics from a project named analytics_utils?Use
{{ analytics_utils.calculate_metrics() }} inside your dbt model or macro to call it from the analytics_utils project.Click to reveal answer
How do you reference a macro from another dbt project?
✗ Incorrect
You must prefix the macro with the project name to call it across projects.
What file do you update to add a dependency on another dbt project?
✗ Incorrect
The
packages.yml file lists external project dependencies.What command installs dependencies listed in packages.yml?
✗ Incorrect
dbt deps downloads and installs dependencies.Why is calling macros across projects useful?
✗ Incorrect
Reusing common logic avoids duplication and improves maintainability.
Which syntax is correct to call macro
foo from project bar?✗ Incorrect
The correct syntax is
{{ bar.foo() }} where bar is the project name.Explain how to set up and call a macro from another dbt project.
Think about configuration and syntax steps.
You got /3 concepts.
Why is it beneficial to call macros across projects in dbt?
Consider how sharing code helps in teamwork.
You got /3 concepts.