Repository navigation
First module of data-stack-lab.
- One seeded synthetic SaaS dataset shared by every module: 1,000 accounts, 11,963 users, 5,048 invoices, 913,388 events, and truth files the warehouse never sees.
- A Kimball star schema in dbt: a Type 2 account dimension built from 13 monthly snapshot loads, invoice and daily-usage facts, enforced contracts, 46 data tests, 3 unit tests. Runs on dbt Core 1.12 and dbt v2 (dbt-oss 2.0.8) with byte-identical results; CI runs both.
- Measured: Type 1 puts $152,227 (15.1%) of a year's revenue on the wrong plan; Type 2 puts 5,048 of 5,048 invoices on the plan they billed. Monthly snapshots saw 533 of 570 changes.
- Four deliberate breaks, each caught. Joining invoices to today's account version passes every data test and is caught only by a unit test. On dbt v2 2.0.8 two unit tests miss their breaks because expected timestamps are not compared (dbt-labs/dbt#15894).
Write-up: https://basantbhattarai.com.np/writing/type-1-dimension-revenue-wrong-plan/