What this thread does
The problem
Your pipeline runs green, but nobody knows whether a load skipped a day, duplicated rows or turned real values into NULL. Often users are the alert ("something seems wrong" was the top-voted joke in a related r/dataengineering thread on data quality tools).
What the thread says
Source: r/dataengineering post by ETL_Pipeline_Dev, "How do you test ETL pipelines?" (2026-08-26). One commenter ordered the practices by value for data work, and others agreed:
1. A staging stack like production with smaller, non-production data that covers your real cases. 2. Data tests on what you expect of sources and outputs. With dbt: tests on sources and outputs plus unit tests for transformations was a highly voted answer. 3. Integrity tests: nothing missing. Compare with the source, or require a minimum row count per period (more than zero already proves the job ran). 4. End-to-end runs with known input and an expected output, locally (DuckDB or Spark to stand in for the warehouse). 5. Unit tests for tricky logic and as regression tests after a bug.
Other points from commenters:
- Keep source keys and load timestamps in the target. Without the source key you can't prove a miss later; for incrementals, store the max source timestamp you actually loaded, because a row count won't show a skipped day.
- Check grain and key uniqueness, NULLs that weren't NULL in the source, impossible values (negative amounts, short zip codes), and orphaned foreign keys on both sides.
- Prefer thresholds to absolute rules for messy inputs (alert at a share of NULLs, not at one).
The dbt pieces
dbt's docs: generic data tests under data_tests: on a column (unique, not_null, accepted_values, relationships), one-off singular tests as a select in tests/ that returns failing rows, severity: warn|error with warn_if/error_if row thresholds, and store_failures to save failing rows to an audit schema. Unit tests are a separate feature defined under models/.
models:
- name: orders
columns:
- name: order_id
data_tests: [unique, not_null]
- name: customer_id
data_tests:
- relationships:
arguments: {to: ref('customers'), field: id}
What to tell your agent
For each model in models/marts, add data tests: unique and not_null on the grain key, relationships for every foreign key, accepted_values for status columns. Add a singular test that fails if yesterday's partition has fewer than 50% of the 7-day average row count, and one that compares source and target counts per day. Use severity warn for thresholds, error for keys. Do not change model SQL.
The last sentence matters: the agent should add checks, not edit transformations until they pass.
Caveats
Practitioner comments plus dbt docs; one commenter mentions agents for troubleshooting as a roadmap item, and the agent prompt is my suggestion and not tested. Some commenters pair dbt with Great Expectations or Soda for statistical checks.
Sources
- Add data tests to your DAG (dbt Labs), read. Checked: the four generic tests
unique,not_null,accepted_values,relationships; thedata_tests:key (tests:still works as an alias, but not both); singular tests areselectfiles in the tests directory that pass when they return zero rows;severityofwarnorerrorwithwarn_ifanderror_ifthresholds;store_failuressaves failing rows (default schemadbt_test__audit); unit tests are a separate feature. Version note: thearguments:form used in the YAML example is available from dbt 1.10.5; on earlier versions,toandfieldsit beside the test name instead. The example matches the page's own relationships example. - The page also says framework options such as
severity,whereandstore_failuresare set underconfig, notarguments.
Checked on 15 November 2026: the r/dataengineering thread, its date, the ordering of practices and what commenters recommended, and the Great Expectations and Soda remarks. Not checked: whether dbt unit tests suit the DuckDB or Spark local-run advice. I did not run dbt, and the agent prompt is untested.
Started from a post by @ETL_Pipeline_Dev, packaged by the editor. Original post