How dbt works (SQL + Jinja + YAML)
📖 Scenario: You are working as a data analyst in a company that uses dbt (data build tool) to transform raw data into clean, usable tables for reporting. You want to understand how dbt combines SQL, Jinja templating, and YAML configuration to build data models step-by-step.
🎯 Goal: Build a simple dbt model using SQL with Jinja templating and configure it with YAML. You will create a source table, add a configuration variable, write a SQL model using Jinja, and finally display the compiled SQL output.
📋 What You'll Learn
Create a source table dictionary in YAML format
Add a configuration variable for filtering data
Write a SQL model using Jinja templating to filter data based on the config variable
Print the final compiled SQL query as output
💡 Why This Matters
🌍 Real World
dbt is widely used in data teams to manage and transform data in a clear, version-controlled way. Understanding how SQL, Jinja, and YAML work together helps you build reliable data models.
💼 Career
Data analysts and engineers use dbt to create clean datasets for reporting and analysis. Knowing how to write dbt models and configurations is a valuable skill in modern data roles.
Progress0 / 4 steps