0
0
dbtdata~10 mins

ref() function for model dependencies 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 reference the model named 'customers' using the ref() function.

dbt
select * from [1]('customers')
Drag options to blanks, or click blank then click option'
Asource
Bref
Ctable
Dmodel
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'source()' instead of 'ref()' to reference models.
Trying to use 'table()' or 'model()' which are not valid dbt functions.
2fill in blank
medium

Complete the code to create a model that selects all columns from the 'orders' model using ref().

dbt
select * from [1]('orders')
Drag options to blanks, or click blank then click option'
Asource
Btable
Cref
Dload
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'source()' which is for external tables, not models.
Using 'load()' which is not a dbt function.
3fill in blank
hard

Fix the error in the code to correctly reference the 'sales' model with ref().

dbt
select * from [1]('sales')
Drag options to blanks, or click blank then click option'
Aref('sales')
Bref(sales)
Csource('sales')
Dref
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the whole function call inside the blank.
Using source() instead of ref().
4fill in blank
hard

Fill both blanks to create a model that selects the 'id' and 'amount' columns from the 'transactions' model using ref().

dbt
select id, amount from [1]([2])
Drag options to blanks, or click blank then click option'
Aref
B'transactions'
C'orders'
Dsource
Attempts:
3 left
💡 Hint
Common Mistakes
Using source instead of ref.
Not putting the model name in quotes.
5fill in blank
hard

Fill all three blanks to create a model that selects 'customer_id' and 'total' from the 'invoices' model, using ref(), and filters totals greater than 100.

dbt
select [1], [2] from [3]('invoices') where total > 100
Drag options to blanks, or click blank then click option'
Acustomer_id
Btotal
Cref
Dsource
Attempts:
3 left
💡 Hint
Common Mistakes
Using source instead of ref.
Swapping the column names or missing quotes in the function call.