Data Quality Testing and Observability
Catching bad data before stakeholders do with automated tests, freshness checks, reconciliation and ownership.
Intermediate · about 4 hours · difficulty 3/5
Learn first: Transforming Data with dbt, Data Cleaning and Quality Checks
Every analyst has shipped a wrong number caused by bad upstream data. Automated data quality checks catch most of these before they reach a dashboard.
Dimensions of quality
- Completeness: are required fields filled, did all expected rows arrive?
- Uniqueness: no duplicate primary keys.
- Validity: values in allowed ranges and sets (status in a known list, amount not negative).
- Consistency: foreign keys match, totals agree across tables.
- Freshness: data updated as recently as expected.
Where to test
- At ingestion: row counts and schema changes vs the source.
- In transformations: dbt tests (
unique,not_null,relationships,accepted_values) or libraries like Great Expectations and Soda. - At the output: reconcile key metrics against a system of record (finance revenue, billing counts).
Observability
Beyond fixed tests, monitor volume, freshness and distribution over time and alert on anomalies, such as a daily row count dropping 40% or a column suddenly 30% null.
Response process
- Every critical table has an owner.
- Failed tests alert the owner, not a generic channel no one reads.
- Dashboards show a warning or data-as-of date when upstream checks fail.
- Write a short incident note after serious data issues: cause, impact, fix, prevention.
Pitfall: adding hundreds of tests nobody monitors, so failures become background noise. Start with keys, freshness and a few business rules on the most important tables. You are ready to move on when your pipeline fails loudly on duplicate keys and stale data.
Key concepts
- Quality dimensions
- Uniqueness and not-null tests
- Freshness checks
- Reconciliation against source systems
- Great Expectations and Soda
- Anomaly monitoring
- Ownership and incident notes
Mini project
Add at least eight tests to a dbt project (keys, accepted values, relationships, freshness) and one custom test that total order revenue matches payments within 0.5%.
Check yourself
Which three data quality checks would you add first to an orders table feeding the revenue dashboard?
Free resources
- dbt docs: data tests (dbt Labs)
- Great Expectations documentation (Great Expectations)