Topic

Data modelling & dbt

Star schemas, slowly changing dimensions and dbt: as-of joins, snapshots, contracts and tests, measured against data whose truth is known.

A model is a set of promises about what a number means: which version of a customer a payment belongs to, what grain a fact table has, which joins can drop or double a row. Most of those promises fail without an error. The totals reconcile and the keys resolve while revenue sits on the wrong plan. These notes build the models in dbt on data whose ground truth is known, so each design choice can be scored, and the tests are broken on purpose to see which ones notice.

All writing

Essay The SaaS reference architecture Reference architecture, measured

For text-to-SQL, the definitions mattered more than the model

70 customer questions with answers computed by SQL. Given the business's definitions as well as the schema, Llama 3.3 70B went from 55 to 70 right.

  • AI agents in production
  • Data modelling & dbt

7 min read

Essay The data stack lab Measured on my own hardware

Wrong data and missing data are caught by different checks

A month of deliveries with nine defects. Row tests caught wrong values; only control totals, volume and platform share saw rows that never arrived.

  • Data quality & contracts
  • Data modelling & dbt

8 min read

Essay The data stack lab Measured on my own hardware

A Type 1 dimension put 15% of a year's revenue on the wrong plan

Type 1 moved $152,227 of a year's revenue to the wrong plan. A Type 2 dimension from dbt snapshots got all 5,048 invoices right; only a unit test saw the bug.

  • Data modelling & dbt
  • Data quality & contracts

11 min read