0
0
dbtdata~20 mins

Model naming conventions in dbt - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
dbt Model Naming Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding dbt Model Naming Patterns

In dbt, model names often follow specific patterns to indicate their purpose. Which of the following model names best represents a staging model for raw customer data?

Aint_customers
Bfct_customers
Cdim_customers
Dstg_customers_raw
Attempts:
2 left
💡 Hint

Staging models usually start with stg_ and represent raw or lightly transformed data.

Predict Output
intermediate
1:30remaining
Output of dbt Model Naming Convention Check

Given the following list of dbt model names, how many are correctly following the common naming conventions for dimension models?

models = ['dim_users', 'fct_sales', 'dim_products', 'stg_orders', 'dim_customers']
dbt
models = ['dim_users', 'fct_sales', 'dim_products', 'stg_orders', 'dim_customers']
dim_models = [m for m in models if m.startswith('dim_')]
print(len(dim_models))
A1
B2
C3
D4
Attempts:
2 left
💡 Hint

Count how many model names start with dim_.

data_output
advanced
2:30remaining
Resulting DataFrame from Model Naming Filter

Consider a pandas DataFrame listing dbt models and their types. Which rows remain after filtering for models with names starting with fct_?

dbt
import pandas as pd
models_df = pd.DataFrame({
  'model_name': ['fct_sales', 'dim_customers', 'stg_orders', 'fct_revenue'],
  'description': ['sales facts', 'customer dimensions', 'order staging', 'revenue facts']
})
fact_models = models_df[models_df['model_name'].str.startswith('fct_')]
fact_models
A[{'model_name': 'fct_sales', 'description': 'sales facts'}, {'model_name': 'fct_revenue', 'description': 'revenue facts'}]
B[{'model_name': 'dim_customers', 'description': 'customer dimensions'}]
CEmpty DataFrame
D[{'model_name': 'stg_orders', 'description': 'order staging'}]
Attempts:
2 left
💡 Hint

Filter rows where model_name starts with fct_.

🔧 Debug
advanced
1:30remaining
Identify the Error in Model Naming Convention Code

What error does the following Python code produce when checking if model names start with stg_?

models = ['stg_orders', 'dim_customers', 'stg_payments']
filtered = [m for m in models if m.startswith('stg_') == True]
print(filtered)
ANo error; outputs ['stg_orders', 'stg_payments']
BTypeError: 'bool' object is not callable
CSyntaxError: invalid syntax
DOutputs an empty list []
Attempts:
2 left
💡 Hint

Check if startswith returns a boolean and how it is used.

🚀 Application
expert
2:30remaining
Choosing the Correct Model Name for a New Intermediate Model

You are creating a new intermediate model in dbt that combines staging data for orders and payments. Which model name best follows dbt naming conventions?

Astg_orders_payments
Bint_orders_payments
Cfct_orders_payments
Ddim_orders_payments
Attempts:
2 left
💡 Hint

Intermediate models often use the prefix int_.