Page MenuHomePhabricator

dbt data tests validate production data
Closed, ResolvedPublic

Description

We should allow dbt users to configure data tests that ensure the integrity of models in production.

Acceptance criteria

  • dbt test runs asynchronously as a repeated process.
  • Model owners are notified when their data test fails.
    • As a start, this can be a notification to Data Engineering on failure of the async run, who then escalates to the relevant model owner(s).
    • Targeted notifications directly to the model owner are a nice-to-have for this milestone.

Not in scope

For this milestone, we're not yet targeting:

  • Running dbt test in Gitlab to block MR submissions that introduce issues.
  • dbt unit tests for logic that is independent of model data.

Both of those are still planned for later in FY26-27.

Event Timeline

dbt test runs asynchronously as a repeated process.

What is implied by the "asynchronous" qualifier? I had an idea of adding a configuration option to enable running the test after the scheduled dbt_run, with the same selector.

Something like

- job_name: moderator_metrics
  scheduled: monthly
  models:
  - +active_moderators_monthly
  tags: []
  exclude: []
  run_test: True

which would translate into

dbt run --select +active_moderators_monthly

followed by

dbt test --select +active_moderators_monthly

Oh good point! I used "asynchronous" mostly to mean "not in CI/Gitlab", but you're right that this still leaves two options:

  1. Run after the dbt run in Airflow, executing only the relevant tests.
  2. Run in a completely independent DAG, executing tests for all models.

I don't have a super strong opinion there, but I feel like 2 is what gives us the biggest coverage for a reasonably low complexity, as it catches test failures caused by factors outside of the dbt run. But happy to be convinced otherwise!

Having discussed this again, I think what we have now implemented (configurable dbt test after dbt run for a set of models) is good enough to satisfy this milestone.

I think the remaining action here is to document how to configure this, in our main dbt documentation on Wikitech. Then we can close this :)