DEV Community

Sam Fisher
Sam Fisher

Posted on

dbt tests that actually catch bad data

Most dbt test suites I've inherited check not_null and unique and not much else. Those catch schema problems, not business problems.

The tests that have saved us:

  • accepted_values for status columns (catch typo'd statuses)
  • A relationships test on every foreign key
  • A custom test for "row count per day should be within 30% of last week"
  • Freshness checks on source tables

The custom tests took an afternoon and have caught two silent pipeline failures.

I'm learning GraphQL next, mostly because our analytics API is moving that direction. Data people: how are you testing your marts?

Top comments (0)