0
0
dbtdata~10 mins

Multi-source fan-in patterns 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 select all columns from the source table.

dbt
select * from [1]
Drag options to blanks, or click blank then click option'
Atable('my_source')
Bref('source_table')
Csource('my_source', 'table')
Dload('source_table')
Attempts:
3 left
💡 Hint
Common Mistakes
Using ref() instead of source() for external tables.
Using incorrect function names like load() or table().
2fill in blank
medium

Complete the code to join two source tables on the 'id' column.

dbt
select a.*, b.value from [1] as a join [2] as b on a.id = b.id
Drag options to blanks, or click blank then click option'
Asource('source_a', 'table_a')
Bref('table_a')
Csource('source_b', 'table_b')
Dref('table_b')
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing ref() and source() incorrectly.
Joining on wrong columns.
3fill in blank
hard

Fix the error in the code to correctly union two source tables.

dbt
select * from [1] union all select * from [2]
Drag options to blanks, or click blank then click option'
Asource('source1', 'table1')
Bref('table1')
Csource('source2', 'table2')
Dref('table2')
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same table for both selects.
Using ref() instead of source() for external tables.
4fill in blank
hard

Fill both blanks to create a model that merges data from two sources using a full outer join.

dbt
select coalesce(a.id, b.id) as id, a.value as value_a, b.value as value_b from [1] as a full outer join [2] as b on a.id = b.id
Drag options to blanks, or click blank then click option'
Asource('source_x', 'table_x')
Bref('table_x')
Csource('source_y', 'table_y')
Dref('table_y')
Attempts:
3 left
💡 Hint
Common Mistakes
Using ref() instead of source() for external tables.
Using inner join instead of full outer join.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that filters and transforms data from multiple sources.

dbt
result = { [1]: [2] for [3] in data if [2] > 10 }
Drag options to blanks, or click blank then click option'
Arecord['id']
Brecord['value']
Crecord
Ditem
Attempts:
3 left
💡 Hint
Common Mistakes
Using inconsistent variable names.
Using wrong keys or values in the dictionary.