There is a very common way of finding out that data is wrong: someone in the business opens a report and asks why yesterday's sales are zero. By then, the error has already reached decisions. Data quality that works is the kind checked automatically on every load, before anyone sees it.
Five checks I'd always add
- Volume. Did roughly the expected number of rows arrive? A load with 90% fewer records than that weekday's average is almost always a problem, even if it technically “finished successfully”.
- Freshness. Is the latest record from when it should be? A process that hangs and leaves three-day-old data is silent if nobody watches it.
- Nulls in mandatory fields. A customer without an ID or a sale without an amount should not reach the clean layer.
- Duplicates. Is the key that should be unique actually unique? Duplicates inflate metrics without anyone noticing.
- Ranges and valid values. Negative ages, future dates, country codes that don't exist. Simple rules that catch many source errors.
Where to put them
The most effective place is the boundary between layers: when moving from raw to clean data, and before publishing the tables the business consumes. Tools like dbt or Great Expectations let you write these rules alongside the transformation code, but the habit matters more than the tool.
What to do when they fail
Not all rules are equal. Decide in advance what happens with each one:
- Block the load when publishing the data would be worse than not publishing it (for example, duplicated amounts in finance).
- Warn and carry on when the data is still useful but someone needs to look at it.
- Set aside failing records in a quarantine table and let the rest through.
And make sure the alert reaches whoever can fix it, with enough context to act. An alert sent to an inbox nobody reads is not an alert.
Start small
You don't need to cover everything on day one. Pick the five most queried tables, add these five checks and expand from there. The first error caught before it reaches a report will pay for the effort.