dbt (Data Build Tool) - dbt turns modular SQL into tested, documented data models inside our data warehouse. It brings software-engineering best practices (version control, tests, documentation, lineage) to analytics workflows and enables incremental builds that speed refreshes and improve reliability.
ref()), configs, and macros let us structure transformations like software projects.ref().view, table, incremental, ephemeral, materialized_view; choose based on performance/cost trade-offs.sources and add schema tests to enforce quality before data reaches BI.├── /opt/airflow/repo/dags/dashboard/
│ └── dag_dbt_dashboard_daily.py → *main dag to run all dbt models*
│
├── /opt/airflow/repo/dags/dbt_project/ → *dbt related files*
│ └── models/
│ ├── intermediate/*
│ ├── marts/*
│ └── staging/*
│ ├── profiles.yml
│ └── dbt_project.yml
models/staging/marts/dm_marketing_trial_expiration.sql
{{
config(
materialized='table',
schema='marts'
)
}}
SELECT
company_id,
company_name,
contact_phone,
contact_email,
trial_start_date,
expiration_date,
days_until_expiration AS days_left,
expiration_segment,
refresh_date
FROM {{ref('int_marketing_trial_expiration')}}
WHERE days_until_expiration BETWEEN 0 and 5
ORDER BY days_left, company_name
stg_*) to clean/standardize raw sources.view or table