What this thread does
The case
You have a pipeline that loads data into a warehouse and transforms it with dbt and SQL. Reports sometimes show too few or too many rows, or totals that look wrong. Success looks like: duplicates and gaps are caught by tests before anyone reads a report, a failing test shows which rows broke it, tricky logic has fixtures, and agent-written models are checked by rules instead of by eye. Stack: dbt and SQL.
This is a map, not new advice: every linked row points to an existing WhatWorks thread. Nobody here ran this whole build; the Status column says what each linked thread rests on. "Tried" would need a linked trial report, and none of the linked threads has one yet.
Parts, in the order people do them
| Part | What to use | Status | Link |
|---|---|---|---|
| Tests on keys, nulls and counts | dbt data tests, row-count thresholds, source-to-target reconciliation | Documented: vendor or primary source, not tried (no linked trial) | How do I test my pipeline so missing or duplicate rows get caught? |
| Logic with tricky cases | dbt unit tests with mocked inputs | Documented: vendor or primary source, not tried (no linked trial) | How do I write dbt unit tests for a model's logic? |
| See which rows failed | store_failures and the audit schema | Documented: vendor or primary source, not tried (no linked trial) | My dbt test fails: how do I see which rows failed? |
| Join fan-out and wrong totals | Check grain before and after each join | Documented: vendor or primary source, not tried (no linked trial) | How do I check AI-written SQL for join fan-out and wrong totals? |
| Agent-written models | Context, skills and deterministic checks | Documented: vendor or primary source, not tried (no linked trial) | How do I stop my agent writing sloppy dbt models? |
| Messy inputs before the load | Profile first, clean with a script and an audit | Documented: vendor or primary source, not tried (no linked trial) | How do I have my agent clean a messy CSV without losing rows? |
| Compare two extracts | Merge and list missing and changed rows | Documented: vendor or primary source, not tried (no linked trial) | How do I compare two spreadsheets and list missing and changed rows? |
| Run the dbt tests automatically in CI | No tested answer yet | No tested answer yet | none (see open request) |
Where it breaks
- Total is too high after a join -> How do I check AI-written SQL for join fan-out and wrong totals?
- A dbt test fails and you cannot see the rows -> My dbt test fails: how do I see which rows failed?
- Duplicates or gaps from a source file -> How do I have my agent clean a messy CSV without losing rows?
- Tests only run on your laptop: No tested answer yet (see gap list)
Open questions
- Parts marked "No tested answer yet" are gaps in WhatWorks; ask for them with the request tool so an editor can look: running dbt tests in CI on every change.
Status key
Documented means the linked thread cites official docs or a vendor source and was not run. Untried means the linked thread rests on a community post or on suggestions and was not run. Tried would need a linked trial report, and none exists yet.
As of October 2026. cleaning one messy upload, see case-import-messy-csv-excel-validation-error-report; charts and dashboards, see case-kpi-dashboard-charts-postgres-scheduled-refresh.
Started from a post by @WhatWorks editors, packaged by the editor.