Model-Driven Development for BI
The model is the product; the report is just a view
Model-driven BI means the model (not the report) is the product: code-versioned schemas, tests, deployment pipelines, and reporting tools that consume the model rather than re-model.
What you will learn
- Shift mindset from report-scoped to model-scoped development
- Version, test and deploy the model like software
- Point BI tools at the model, not raw tables
What is this?
Model-driven development treats the data model as the primary artifact: schemas and metrics are code, reviewed, versioned and tested in CI, deployed through environments, and consumed by BI tools that read the model. Reports become thin views over a trusted model — instead of each workbook secretly carrying its own modeling (and its own bugs).
Why do you need it?
- Model bugs ripple to every report; fixing the model fixes them all.
- Code review + tests catch the 'works locally' regression early.
- Environment parity (dev/staging/prod) makes deploys safe.
- BI-as-code is the accepted modern stack: dbt + semantic layers + thin front-ends.
Mental model
Library vs handwritten copies per reader
Model-driven vs report-driven
A shared, well-proofread book in the library serves everyone identically. Report-driven BI is every reader copying the text by hand — typos multiply. Model-driven means editing and reviewing the one book, then reprinting.
How it works
- Models and metrics live in code (dbt, LookML, TMD) under version control.
- CI runs tests: data tests, metric reconciliation, freshness, schema tests.
- Environment promotion moves models dev → staging → prod with parity.
- BI tools connect to the deployed model; reports declare what they show, not how it's built.
- Rollbacks are model version pins — reports point at a pinned, verified model.
Code-model → CI → deploy → thin reports.
Examples
The workflow that makes models trustworthy
dev: edit fact_orders.sql + revenue.yml, add a testpr: reviewers check diff; CI runs: - unique/not_null tests on keys - revenue reconcile vs control - freshness (max(date) < 2d)staging: deploy, BI tool points "test" workspace hereprod: promote; consumers see the certified metricrollback: pin previous model version; reports reconnectModels change under the same discipline as application code — review, test, promote — so reports trust them.
In production
- A dbt project versions fact/dim models; 'Revenue' metric is certified in the catalog.
- Power BI/Tableau point at model views, so a model fix updates every workbook in one deploy.
- CI reconcile test fails on a 2% drift — the team investigates before even opening a report.
Best practices
- Model in code with tests; reports stay thin and declarative.
- Add data-quality gates to the pipeline (not just after facts).
- Name and document each model like an API.
- Pin and version models; make rollbacks reproducible.
Common mistakes
- Modeling 'in the tool' again — every workbook carries its own joins.
- No tests: the model compiles, therefore it's 'correct'.
- Direct prod model edits without review or parity.
- Reports bypassing the certified model for one-off figures — trust leaks.
Debugging tips
- A report broke after deploy → check the model diff and its pinned version.
- CI test fails on reconcile → diff the metric filter/definition against control.
- Two environments disagree → parity check; one env has drifted code.
Interview checkpoint
Hands-on lab
- Write a model view with tests baked into SQL
- Add a data-quality gate before reports
- Simulate CI failure (reconcile drift) and fix
Drive Everything from a SQL Model
45 min · advanced
Quick quiz
In model-driven BI, the main reusable artifact is:
A model change is automatically safe because CI passed.