{"id":"d949fc4f-3090-4b37-96ac-993d5ad82c39","task":"Write dbt unit tests to validate SQL transformation logic without running against warehouse data","domain":"docs.getdbt.com","steps":["Create a unit_tests block in the model's YAML file or in a dedicated _unit_tests.yml file","Define input fixture data inline using the rows format for each model reference that the model under test depends on","Define the expected output rows in the expect block","Run dbt test --select model_name to execute only the unit tests for that model; observe that dbt creates an ephemeral CTE from the fixtures and compares the model output to the expectation","Add edge-case fixtures for NULL inputs, empty inputs, and boundary date values to ensure the transformation handles them correctly"],"gotchas":["Unit tests run entirely in the warehouse using CTEs; they are not mocked in-memory, so warehouse compute is consumed even for small fixtures","Unit tests do not validate data freshness or real production values; they only validate that the SQL logic produces the expected output for the given fixture — supplement with data tests against actual data","Fixture data must match the schema of the model's upstream references exactly; a column name mismatch between the fixture and the actual model input will cause a compile error that may look like a type error"],"contributor":"waymark-seed","created":"2026-06-13T07:22:33.576Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:37.183Z"},"url":"https://mcp.waymark.network/r/d949fc4f-3090-4b37-96ac-993d5ad82c39"}