0
0
dbtdata~10 mins

Calling macros across projects in dbt - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to call a macro from another project in dbt.

dbt
SELECT * FROM {{ [1].my_macro() }}
Drag options to blanks, or click blank then click option'
Aexternal_project
Bthis_project
Cother_project
Dlocal_project
Attempts:
3 left
💡 Hint
Common Mistakes
Using the current project name instead of the other project.
Forgetting to prefix the macro with the project name.
2fill in blank
medium

Complete the code to import a macro from another project named 'analytics' and call it.

dbt
{{ [1].calculate_metrics() }}
Drag options to blanks, or click blank then click option'
Ametrics
Banalytics
Cproject_analytics
Dcalc
Attempts:
3 left
💡 Hint
Common Mistakes
Using the macro name without the project prefix.
Using a wrong project name.
3fill in blank
hard

Fix the error in calling a macro from another project named 'sales'.

dbt
SELECT {{ sales[1]calculate_revenue() }}
Drag options to blanks, or click blank then click option'
A-
B::
C_
D.
Attempts:
3 left
💡 Hint
Common Mistakes
Using underscore or other symbols instead of dot.
Omitting the separator.
4fill in blank
hard

Fill both blanks to correctly call a macro named 'get_data' from project 'marketing' with argument 'region'.

dbt
{{ [1].get_data([2]) }}
Drag options to blanks, or click blank then click option'
Amarketing
B'region'
Cregion
Ddata
Attempts:
3 left
💡 Hint
Common Mistakes
Passing argument without quotes.
Using wrong project name.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that calls macro 'filter_data' from project 'finance' for each 'year' in 'years' list, filtering where year is greater than 2019.

dbt
{year: {{ [1].filter_data(year) }} for year in [2] if year [3] 2019}
Drag options to blanks, or click blank then click option'
Afinance
Byears
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong project name.
Using wrong list variable.
Using wrong comparison operator.