Data Modelling & Transformation
You'll be able to:
You can design a layered warehouse model (raw → staging → mart) and explain when a star schema beats a wide table, and why dbt-style version-controlled transformations replaced hand-written stored procedures.
Two analysts present revenue for the same quarter in the same meeting. One says 4.2 million, the other says 3.9 million. Both wrote correct SQL. Both are defensible. The next forty minutes are spent reconciling numbers instead of making the decision the meeting was called for. This is not an arithmetic problem — it is a modelling problem, and it is solved before anyone opens a query editor.
The three layers
A well-structured warehouse separates data into layers with distinct jobs. Raw is an untouched, append-only copy of what the source sent. Staging is cleaned and typed, mapping roughly one-to-one with source tables — renamed columns, parsed dates, consistent casing. Marts are business concepts: joined, aggregated, and named the way the business speaks.
The reason to keep raw data, which teams under-appreciate until it bites them, is replayability. When you discover that a transformation has been subtly wrong for four months, having raw means you rebuild the last four months correctly. Teams that transform on ingestion and discard the original can only fix things going forward. "We can correct it from today" is the sentence that reveals a missing raw layer.
Star schema or wide table
A star schema separates facts (events with measures) from dimensions (descriptive attributes), joined on keys. A wide table flattens everything into one denormalized result.
Columnar storage weakened the classic argument for normalization — scanning is cheap and storage is cheaper, so the old cost of a wide table largely evaporated. But star schemas still win decisively in one situation: when dimensions change independently of facts and multiple fact tables must agree on the same dimension. A single conformed customer dimension means orders, support tickets, and sessions all describe customers identically. Denormalize that attribute into three wide tables and they will drift.
Why dbt-style transformation replaced stored procedures
The SQL did not change. The engineering discipline around it did. A stored procedure has no meaningful diff, no test suite, no staging environment, and no lineage graph — a change goes straight to production and its blast radius is unknowable. Version-controlled transformation brings code review, automated tests, environment separation, and a dependency graph you can inspect. The improvement is entirely in the process, not the language.
Failure modes
Metric drift — the same metric is defined independently in several dashboards and slowly diverges as each is patched. Signal: recurring reconciliation meetings, and a shared belief that one particular dashboard is "the accurate one."
Lost history — raw was discarded to save storage; a transformation bug is found months later. Signal: an incident review whose remediation is "corrected going forward" because rebuilding is impossible.
Dimension update anomaly — a customer's country is denormalized into historical fact rows. The customer relocates, the attribute is overwritten, and last quarter's regional split silently changes. Signal: a previously published breakdown that no longer reproduces.
Fan-out join — a fact table is joined to a one-to-many table without aggregating first, multiplying every measure. Signal: revenue jumping by a suspiciously clean factor, often close to the average number of line items per order.
Explaining this to stakeholders
On the layers: raw is the delivery of unopened ingredients, staging is the prepped and measured mise en place, and the mart is the plated dish. You keep the ingredients because if the sauce is wrong you want to cook it again, not scrape the plate.
On stored procedures versus modern transformation: one is editing the live website over FTP, the other is deploying from version control. The code might be identical; the ability to review it, test it, and undo it is not.
Curated Materials
1.2hThe deep work happens here — the lesson is your briefing.
Live on aiqbench
This lesson's subject on the rest of the site, today.
In the news, last 30 days
- RoboIntervene: A Dataset for Learning When to Step In and How to Recover Robot Policy ExecutionarXiv ·
- HuGEM: A Humanoid Manipulation Dataset with Paired Goal- and Execution-Level InstructionsarXiv ·
- Human-Agent Forensics and Recovery of an Extreme-Scale Climate DatasetarXiv ·
Test your knowledge
5 questions in 100 seconds, on a page of its own. Read everything above first.
Test your knowledge →Module Mission
25–35 minFor an e-commerce dataset with orders, customers, and products, sketch a staging layer and a mart layer. Name one metric that would be ambiguous without an explicit definition and write that definition.
Loading your work…