0
0
dbtdata~10 mins

Organizing models in directories 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 specify the directory for models in the dbt project configuration.

dbt
models:
  [1]:  # directory name
    +materialized: view
Drag options to blanks, or click blank then click option'
Aanalysis
Bstaging
Cmodels
Dsources
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'models' as a directory name inside the models config causes redundancy.
Confusing 'sources' with model directories; sources are defined separately.
2fill in blank
medium

Complete the code to define a subdirectory for customer models inside the models directory.

dbt
models:
  [1]:
    +materialized: table
Drag options to blanks, or click blank then click option'
Amarketing
Bsales
Ccustomers
Dfinance
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing unrelated directory names like 'finance' when the models are about customers.
Using uppercase letters in directory names which is not a common practice.
3fill in blank
hard

Fix the error in the dbt project configuration to correctly organize models in the 'analytics' directory.

dbt
models:
  analytics:
    +materialized: [1]
Drag options to blanks, or click blank then click option'
Atable
Bview
Cincremental
Dtemporary
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'temporary' which is not a valid materialization in dbt.
Choosing 'view' which creates non-persistent models.
4fill in blank
hard

Fill both blanks to configure the 'finance' directory with incremental models and the 'marketing' directory with views.

dbt
models:
  finance:
    +materialized: [1]
  marketing:
    +materialized: [2]
Drag options to blanks, or click blank then click option'
Aincremental
Bview
Ctable
Dephemeral
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up 'table' and 'incremental' materializations.
Using 'ephemeral' which does not create physical tables or views.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps model names to their materializations, filtering only models with materialization 'table'.

dbt
model_materializations = {model: config[1] for model, config in models_config.items() if config[1][2] 'table' and model[3]('sales')}
Drag options to blanks, or click blank then click option'
A['materialized']
B==
Cstartswith
Din
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'in' instead of 'startswith' for filtering model names.
Using dot notation instead of square brackets to access dictionary keys.