The Northwind Star Schema (db/dbt/)

The included db/dbt/ project transforms the raw Northwind OLTP tables into a fully tested star schema. Here is what it builds.

Star Schema ERD

dim_customer
customer_key PK
company_name
country
continent
dim_product
product_key PK
product_name
category
list_price
fact_sales
sales_key PK
date_key ─▸ dim_time
customer_key ◀─ dim_customer
product_key ◀─ dim_product
employee_key ─▸ dim_employee
quantity
unit_price
gross_revenue
net_revenue
dim_employee
employee_key PK
full_name
title
dim_time
date_key PK
year
quarter
month

The fact_sales table sits at the center. Each row is one line item from an order. The four dimension tables surround it, providing the "who, what, when, where" context for each sale.

Objects Created

Type Count Objects
Staging Views 5 stg_orders, stg_order_details, stg_customers, stg_products, stg_employees
Dimension Tables 4 dim_customer, dim_product, dim_employee, dim_time
Fact Table 1 fact_sales (~8,000 rows)
Analytical Views 2 vw_sales_detail, vw_monthly_sales
Total 12 Created with one command: docker compose run dbt-transform run

Tests Included

not_null — Primary keys and critical columns must never be NULL
unique — Primary keys must be unique across the table
relationships — Referential integrity: every foreign key in fact_sales must exist in its dimension table
accepted_values — Continent column must be one of: North America, South America, Europe, etc.

Tests run with docker compose run dbt-transform test and validate data quality on every build.

All 12 objects are created with a single command: docker compose run dbt-transform run