raw.* -> stg_* -> martsRaw data stays untouched
Raw schemas are never edited. Every fix happens in staging, so any day can be rebuilt from source.
A personal project modelled on a small online shop: five data sources, one warehouse, and metrics that mean the same thing in every dashboard.
Airflow runs one DAG per source every morning and lands the data in raw schemas, unchanged.
dbt builds staging models per source, then marts: fct_orders, dim_customers and revenue_weekly.
Unique, not-null, relationship and freshness tests run after each load; a failure stops the models downstream.
Power BI reads the marts, and metric definitions live in one place in dbt.
-- models/marts/revenue_weekly.sql
select
date_trunc('week', ordered_at) as week,
sum(amount_net) as revenue,
count(distinct customer_id) as customers
from {{ ref('fct_orders') }}
where status = 'completed'
group by 1raw.* -> stg_* -> martsRaw schemas are never edited. Every fix happens in staging, so any day can be rebuilt from source.
dbt build --select +revenue_weeklyEach model ships with its tests, and a failing test stops everything built on top of it.
metrics: revenue, active_customersRevenue and active customers are defined in dbt, so dashboards read them instead of computing their own.
A text-to-SQL assistant that reads the dbt docs, writes read-only SQL and shows its query beside every answer.