What if a simple naming rule could save you hours of frustration every week?
Why Model naming conventions in dbt? - Purpose & Use Cases
Start learning this pattern below
Jump into concepts and practice - no test required
Imagine you have dozens of data models saved with random or unclear names like 'model1', 'temp_data', or 'final_version'. When you or your team need to find or update a specific model, it feels like searching for a needle in a haystack.
Without clear naming rules, it's easy to get confused, make mistakes, or waste time guessing which model does what. This slows down your work and can cause errors in reports or analysis.
Using consistent model naming conventions means every model name clearly shows its purpose, source, or stage. This makes it quick and easy to find, understand, and maintain your data models.
select * from model1; select * from temp_data;
select * from stg_customers; select * from int_orders_summary;
Clear model names unlock smooth teamwork, faster debugging, and confident data analysis.
A data analyst quickly finds the 'stg_sales' model to check raw sales data, then uses 'int_sales_summary' to build reports, all without asking anyone for help.
Random names cause confusion and slow work.
Consistent naming makes models easy to find and understand.
Good names improve teamwork and data quality.
Practice
Solution
Step 1: Understand dbt naming conventions
dbt recommends using clear, lowercase names with underscores to separate words for readability and consistency.Step 2: Evaluate each option
Use clear, lowercase names with underscores to separate words follows the recommended style. Options A, B, and D do not follow best practices.Final Answer:
Use clear, lowercase names with underscores to separate words -> Option AQuick Check:
Clear lowercase with underscores = C [OK]
- Using uppercase letters in model names
- Including spaces or special characters
- Using inconsistent naming styles
Solution
Step 1: Check naming rules for dbt models
Model names should be lowercase and use underscores to separate words, avoiding special characters and uppercase letters.Step 2: Analyze each option
customer_orders uses lowercase letters and underscores only, making it valid. Options B, C, and D contain uppercase letters or special characters.Final Answer:
customer_orders -> Option AQuick Check:
Lowercase with underscores = A [OK]
- Using uppercase letters in model names
- Including hyphens or special characters
- Starting names with numbers
monthly_sales_summarysalesMonthlySummarymonthly-sales-summaryMonthlySalesSummarySolution
Step 1: Identify the best naming style for dbt models
dbt prefers lowercase names with underscores to separate words for clarity and consistency.Step 2: Compare each model name
monthly_sales_summary uses lowercase with underscores and clearly describes the model. Options A and B use camel case or uppercase letters, and C uses hyphens, which are not recommended.Final Answer:
monthly_sales_summary -> Option DQuick Check:
Lowercase with underscores = D [OK]
- Using camelCase or PascalCase
- Using hyphens instead of underscores
- Ignoring clarity in names
CustomerOrders. What is the issue with this name and how can you fix it?Solution
Step 1: Identify naming convention violation
The model name uses uppercase letters, which is against dbt's lowercase naming convention.Step 2: Apply correct naming style
Rename the model to lowercase letters with underscores:customer_orders.Final Answer:
It uses uppercase letters; rename tocustomer_orders-> Option BQuick Check:
Uppercase letters not allowed = A [OK]
- Ignoring uppercase letters in names
- Removing underscores instead of fixing case
- Adding unnecessary special characters
Solution
Step 1: Understand naming best practices
dbt model names should be lowercase, use underscores, and clearly describe the model's content.Step 2: Evaluate each option
total_revenue_per_category_last_year uses lowercase letters and underscores, and clearly describes the model. Options A and C use uppercase or camel case, and D uses hyphens.Final Answer:
total_revenue_per_category_last_year -> Option CQuick Check:
Lowercase with underscores and clear description = B [OK]
- Using camelCase or PascalCase
- Using hyphens instead of underscores
- Using uppercase letters
