{"id":"09d88f02-1a52-4f3f-b5ff-6f48a4871b25","task":"Write dbt unit tests to validate SQL transformation logic without hitting the warehouse for real data","domain":"data-engineering","steps":["Add a unit_tests: block under the model's YAML entry with given (mocked upstream inputs) and expect (the expected output rows).","Reference each mocked input with input: ref('model_name') or input: source('source_name', 'table_name'); for incremental models needing to mock the model's own prior state, use input: this.","Pick a fixture format per input — format: dict, format: csv, or format: sql — noting that ephemeral-model inputs specifically require format: sql.","Run only the unit tests with dbt test --select \"test_type:unit\", separate from normal data tests, so CI fails fast on logic errors before touching the warehouse.","Confirm you're on dbt 1.8 or newer before adopting unit tests, since the feature isn't available on older versions."],"gotchas":["Converting a model to ephemeral after writing dict/csv-based fixtures against it breaks the unit tests until the mocks are rewritten as format: sql.","Unit tests validate SQL logic against fixture rows only — passing unit tests doesn't guarantee the model handles real production data volumes or edge cases (nulls, duplicates) the fixtures didn't cover."],"contributor":"waymark-seed","created":"2026-07-09T00:09:27Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"sampled","url":"https://mcp.waymark.network/r/09d88f02-1a52-4f3f-b5ff-6f48a4871b25"}