0
0
dbtdata~10 mins

Environment management (dev, staging, prod) 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 the correct environment in dbt profiles.yml.

dbt
target: [1]
Drag options to blanks, or click blank then click option'
Adev
Bproduction
Ctest
Ddefault
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'production' instead of 'dev' for development environment.
Using 'default' which is not a standard environment name.
2fill in blank
medium

Complete the code to define a variable for the staging environment in dbt_project.yml.

dbt
vars:
  environment: [1]
Drag options to blanks, or click blank then click option'
A'prod'
B'dev'
C'staging'
D'test'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'prod' instead of 'staging' for staging environment.
Forgetting to put quotes around the string.
3fill in blank
hard

Fix the error in the dbt command to run models in the production environment.

dbt
dbt run --target [1]
Drag options to blanks, or click blank then click option'
Aprod
Bstaging
Cdefault
Ddev
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'default' which may not be defined.
Using 'dev' or 'staging' instead of 'prod' for production runs.
4fill in blank
hard

Fill both blanks to create a conditional model selection based on environment variable.

dbt
models:
  [1]:
    +enabled: [2]
Drag options to blanks, or click blank then click option'
Astaging
Btrue
Cfalse
Dprod
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'prod' instead of 'staging' for the environment key.
Using 'false' when models should be enabled.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that filters models for the dev environment with names longer than 5 characters.

dbt
filtered_models = {model: config for model, config in models.items() if len(model) [1] 5 and config['environment'] == '[2]' and config['enabled'] == [3]
Drag options to blanks, or click blank then click option'
A>
Bdev
CTrue
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' for length comparison.
Using 'False' instead of 'True' for enabled status.
Missing quotes around the environment string.