Environment management (dev, staging, prod)
📖 Scenario: You work as a data analyst using dbt to build data models. Your team uses three environments: development (dev), staging, and production (prod). Each environment has its own database schema to keep data separate and safe.Managing these environments correctly helps you test changes without affecting live data.
🎯 Goal: You will create a dbt project configuration that defines separate schemas for dev, staging, and prod environments. Then, you will write a model that uses the correct schema based on the environment. Finally, you will print the schema name used in the current environment.
📋 What You'll Learn
Create a dbt
profiles.yml configuration with dev, staging, and prod schemasCreate
dbt_project.yml linking to the profileWrite a dbt model SQL file that uses the schema based on
targetPrint the schema name used for the current environment
💡 Why This Matters
🌍 Real World
Managing multiple environments in dbt helps teams develop and test data models safely without affecting production data.
💼 Career
Data engineers and analysts often need to configure and use environment management in dbt to ensure reliable and safe data workflows.
Progress0 / 4 steps