📖 Scenario: You are part of a growing data team using dbt to manage data transformations. As more team members join, organizing your dbt project well becomes important to keep work clear and efficient.
🎯 Goal: Build a simple dbt project structure that shows how to organize models by team responsibility to help scale work as the team grows.
📋 What You'll Learn
Create a dictionary called models with keys as team names and values as lists of model names
Create a variable called team_to_focus and set it to the team name to analyze
Use a for loop with variables model to get all models for the selected team from models
Print the list of models for the selected team
💡 Why This Matters
🌍 Real World
In real data teams, organizing dbt models by team or function helps avoid confusion and merge conflicts as more people work on the project.
💼 Career
Data engineers and analysts often collaborate on dbt projects. Knowing how to structure projects for team scaling is a valuable skill.
Progress0 / 4 steps
1
Create the dbt project model structure
Create a dictionary called models with these exact entries: 'analytics': ['user_activity', 'sales_summary'], 'engineering': ['raw_events', 'staging_users'], 'marketing': ['campaign_performance', 'lead_scoring']
dbt
Hint
Use curly braces to create a dictionary. Keys are team names as strings, values are lists of model names.
2
Select the team to focus on
Create a variable called team_to_focus and set it to the string 'analytics'
dbt
Hint
Assign the string 'analytics' to the variable team_to_focus.
3
Get models for the selected team
Create a list called selected_models by using a for loop with variable model to iterate over models[team_to_focus] and collect each model
dbt
Hint
Use a list comprehension with model iterating over models[team_to_focus].
4
Print the selected team's models
Write a print statement to display the selected_models list
dbt
Hint
Use print(selected_models) to show the list of models.
Practice
(1/5)
1. Why is having a clear project structure important when the dbt team grows larger?
easy
A. It helps keep work organized and reduces confusion among team members.
B. It makes the project run faster on the computer.
C. It allows the team to use more complex SQL queries.
D. It automatically fixes errors in the data models.
Solution
Step 1: Understand team collaboration needs
As team size increases, many people work on the same project, so organization is key to avoid confusion.
Step 2: Recognize the role of project structure
A clear structure helps separate work, making it easier to manage and understand for everyone.
Final Answer:
It helps keep work organized and reduces confusion among team members. -> Option A
Quick Check:
Clear structure = organized teamwork [OK]
Hint: Think about teamwork and avoiding confusion [OK]
Common Mistakes:
Confusing project speed with team organization
Assuming structure fixes errors automatically
Believing complexity equals better structure
2. Which of the following is the correct way to organize models in a dbt project for a growing team?
easy
A. Separate models into folders by their purpose or domain.
B. Use random folder names to avoid conflicts.
C. Write all models in a single SQL file.
D. Put all models in one folder to keep things simple.
Solution
Step 1: Review folder organization best practices
Separating models by purpose or domain helps teams work independently without conflicts.
Step 2: Evaluate options
Keeping all models in one place or random names causes confusion and conflicts.
Final Answer:
Separate models into folders by their purpose or domain. -> Option A
Quick Check:
Folder by purpose = less conflict [OK]
Hint: Group models by what they do, not all together [OK]