What is the main purpose of naming conventions in dbt projects?
Naming conventions help keep your project organized, make it easier to understand, and allow teams to work together smoothly by using consistent names for models, tests, and sources.
Click to reveal answer
beginner
Why should you avoid using spaces and special characters in dbt model names?
Spaces and special characters can cause errors or confusion in SQL queries and file systems. Using underscores (_) or camelCase keeps names simple and safe to use everywhere.
Click to reveal answer
intermediate
What is a common pattern for naming dbt models to show their purpose?
A common pattern is to use prefixes or suffixes like 'stg_' for staging models, 'int_' for intermediate models, and 'fct_' for fact tables. This helps quickly identify the role of each model.
Click to reveal answer
intermediate
How do naming conventions help when your dbt project grows larger?
They make it easier to find and understand models, avoid name clashes, and support automation tools that rely on predictable names. This saves time and reduces mistakes.
Click to reveal answer
beginner
What should you consider when naming sources in dbt?
Use clear, descriptive names that match the original data source names or business terms. This helps everyone know where data comes from and keeps documentation clear.
Click to reveal answer
Which of the following is a good naming convention for a staging model in dbt?
Acustomers staging
BCustomers Staging
Cstg_customers
Dstg-customers!
✗ Incorrect
Using 'stg_customers' is clear, consistent, and avoids spaces or special characters.
Why is it important to have consistent naming conventions in large dbt projects?
ATo confuse new team members
BTo make the project look colorful
CTo make SQL queries longer
DTo help team members understand and find models easily
✗ Incorrect
Consistent naming helps everyone understand the project and find what they need quickly.
Which character is recommended to separate words in dbt model names?
A_
B-
CSpace
D!
✗ Incorrect
Underscores (_) are safe and commonly used to separate words in names.
What prefix might you use for a fact table model in dbt?
Adim_
Bfct_
Cstg_
Dtmp_
✗ Incorrect
'fct_' is commonly used to indicate fact tables in naming conventions.
When naming sources in dbt, you should:
AMatch names to original data sources or business terms
BUse random abbreviations
CUse very long names with spaces
DUse special characters to stand out
✗ Incorrect
Clear, descriptive names matching original sources help with understanding and documentation.
Explain why consistent naming conventions are important when your dbt project grows.
Think about how many people and models are involved in a big project.
You got /4 concepts.
Describe a simple naming pattern you could use for different types of dbt models.
Consider how to quickly tell what a model does just by its name.
You got /3 concepts.
Practice
(1/5)
1. Why is it important to use consistent prefixes like stg_, int_, and fct_ in dbt projects?
easy
A. They make the SQL code run faster.
B. They help organize models by their role, making the project easier to understand.
C. They automatically create indexes in the database.
D. They allow dbt to skip testing models.
Solution
Step 1: Understand the purpose of prefixes in dbt
Prefixes like stg_ (staging), int_ (intermediate), and fct_ (fact) indicate the role of each model.
Step 2: Recognize how prefixes help in large projects
Using these prefixes organizes models logically, making it easier to find and maintain them.
Final Answer:
They help organize models by their role, making the project easier to understand. -> Option B
Quick Check:
Consistent prefixes = better organization [OK]
Hint: Remember: prefixes show model roles clearly [OK]
Common Mistakes:
Thinking prefixes affect performance
Assuming prefixes create database indexes
Believing prefixes skip tests
2. Which of the following is the correct way to name a staging model for customer data in dbt?
easy
A. stgCustomerData
B. StgCustomerData
C. STG_CUSTOMER_DATA
D. stg_customer_data
Solution
Step 1: Recall dbt naming style guidelines
dbt recommends lowercase letters and underscores to separate words for readability.
Step 2: Evaluate each option
stg_customer_data uses lowercase and underscores, matching the recommended style.
Final Answer:
stg_customer_data -> Option D
Quick Check:
Lowercase + underscores = correct naming [OK]
Hint: Use lowercase and underscores for dbt model names [OK]
Common Mistakes:
Using uppercase letters
Using camelCase instead of underscores
Starting with uppercase letters
3. Given the following dbt model names, which one is a fact table according to naming conventions?
stg_ means staging, int_ means intermediate, fct_ means fact table.
Step 2: Match the prefix to the fact table
Only fct_sales_summary starts with fct_, indicating a fact table.
Final Answer:
fct_sales_summary -> Option C
Quick Check:
Prefix fct_ = fact table [OK]
Hint: Fact tables start with fct_ prefix [OK]
Common Mistakes:
Confusing staging and fact prefixes
Ignoring prefix meanings
Choosing intermediate models as fact tables
4. You see a dbt model named fct_customer_orders but it contains only raw data loading logic without aggregations. What is the likely issue?
medium
A. The model name prefix fct_ is incorrect for raw data; it should be stg_.
B. The model should be renamed to int_customer_orders because it is intermediate.
C. The model name is fine; raw data can be in fact tables.
D. The model should be deleted because it is redundant.
Solution
Step 1: Understand prefix meanings
fct_ is for fact tables, which usually contain aggregated or transactional data, not raw loads.
Step 2: Match model content to prefix
Since the model only loads raw data, stg_ (staging) prefix is more appropriate.
Final Answer:
The model name prefix fct_ is incorrect for raw data; it should be stg_. -> Option A
Quick Check:
Raw data = stg_ prefix [OK]
Hint: Match prefix to model content type [OK]
Common Mistakes:
Assuming any prefix works for any model
Thinking raw data belongs in fact tables
Renaming without checking model logic
5. In a large dbt project, you want to create a naming convention that helps new team members quickly identify model types and their dependencies. Which approach best supports this goal?
hard
A. Use consistent prefixes like stg_, int_, fct_, keep names lowercase with underscores, and document the naming rules.
B. Use random prefixes for variety, mix uppercase and lowercase, and avoid documentation to encourage exploration.
C. Name all models with the project name prefix only, ignoring model roles and dependencies.
D. Use only numbers as prefixes to indicate model order, without descriptive names.
Solution
Step 1: Identify best practices for naming at scale
Consistent prefixes and lowercase with underscores improve clarity and readability.
Step 2: Recognize importance of documentation
Documenting naming rules helps new team members understand conventions and dependencies quickly.
Final Answer:
Use consistent prefixes like stg_, int_, fct_, keep names lowercase with underscores, and document the naming rules. -> Option A