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?
Staging models usually start with stg_ and represent raw or lightly transformed data.
In dbt, stg_ prefix is used for staging models that prepare raw data for further transformations. int_ is for intermediate models, dim_ for dimension tables, and fct_ for fact tables.
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']
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))
Count how many model names start with dim_.
Models starting with dim_ are dimension models. Here, 'dim_users', 'dim_products', and 'dim_customers' match, totaling 3.
Consider a pandas DataFrame listing dbt models and their types. Which rows remain after filtering for models with names starting with fct_?
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
Filter rows where model_name starts with fct_.
Only 'fct_sales' and 'fct_revenue' start with 'fct_', so only those rows remain after filtering.
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)Check if startswith returns a boolean and how it is used.
The code correctly filters model names starting with 'stg_'. The comparison to True is redundant but valid. The output is the list of matching models.
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?
Intermediate models often use the prefix int_.
The int_ prefix is used for intermediate models that combine or transform staging data before final models. stg_ is for raw staging, fct_ for fact tables, and dim_ for dimension tables.