How it works · 23 of 38 Advanced
What are data quality checks, data lineage and data contracts?
Catch it at the tap
Data quality, lineage & contracts: A pipeline that runs without errors can still deliver wrong numbers; data tests check what each step produced and stop a bad load, lineage records which job read and wrote which table so a bad number can be traced to its source and to everything else it reached, and a data contract makes the producing team check its own output's shape before it ships.
Loading the animation…
Say it like this A green pipeline only means the jobs ran; data tests check what they produced, lineage shows where a bad number came from and what else it reached, and a data contract stops a breaking change at the team that made it.
Under the hood — for builders
- Real case: Mars Climate Orbiter (1999)
- Lost on arrival at Mars on 23 September 1999 through "a failure to translate English units to metric" (NASA):
- No job failed
- Every pipeline ran green: the code worked, the numbers were wrong. Only a test on the data catches that.
- A data test returns the bad rows
- The scene's rule: any payment of ₹5 crore or more. Zero rows back means pass:
- Built-in tests (dbt)
- Four come ready: unique, not_null, accepted_values, relationships. Add range and freshness tests yourself.
- Lineage
- The recorded map of which job read and wrote which table: it traces a bad number back to its source.
- Data contract
- The producer's checked promise of columns, types and meaning. Types alone miss paise vs rupees: name it amount_inr.
- Watch out
- Stop a bad load rather than publish it: a stale, labelled number beats a wrong one.
- Sources
- NASA Science, "Mars Climate Orbiter" · dbt Docs, "Add data tests to your DAG" (read November 2026).
What happens in the data quality, lineage & contracts animation, step by step?
- Data flows from the apps that create it, through pipelines and tables, into dashboards, models and reports. Each light is a pipeline job; green means it ran without an error.
- One Monday the payments team starts storing amounts in paise, not rupees. Every job still runs green, and the CFO's dashboard shows ₹4,200 crore disbursed instead of ₹42 crore.
- Your turn: the CFO is on the phone. Which source broke the number? Tap one. Lineage, the recorded map of which job read and wrote which table, will trace it.
- A data test is a check a pipeline runs on what it produced; it returns the rows that break a rule. dbt ships four: unique, not_null, accepted_values, relationships. Add "amount under ₹5 crore" and 8 rows fail: the valve shuts and the dashboard holds yesterday's figure, marked stale, not a wrong one.
- Better still, a data contract: the producer promises the shape (amount, in rupees, two decimals) and its own build checks it. dbt fails a model's build if the output doesn't match its contract. The payments team finds out before shipping, not the CFO after.
- Units are the classic broken contract: NASA lost the Mars Climate Orbiter on 23 September 1999 because ground software used English units and the spacecraft used metric. Tests like these need realistic data. Can it be made up? Next: synthetic data.
What everyday example explains data quality, lineage & contracts?
A city's water supply. Pumps can all be running while the water is dirty; testing at the treatment plant shuts the outlet before dirty water reaches taps; the pipe map tells you which reservoir it came from and which streets drank it; and a contract with the factory upstream means it tests its own waste before releasing it.
Why should a team care about data quality, lineage & contracts?
Before a dashboard or model goes live, decide which tests guard each table it reads (not_null, unique, ranges, freshness), record lineage so an incident starts with a map, and ask the teams that produce your key inputs for a contract their own builds enforce.