The Mental Model
CI/CD for analytics engineering applies software delivery discipline to data models: compile, test, document, review, and deploy with clear gates.
Before a change reaches users, it should pass the same kind of gate a backend service would pass. Does it build? Do tests pass? What downstream objects change?
Dataset reference: ecommerce tables and grain assumptions.
Select downstream work for a changed dimension
A pull request changes dim_customers.country. A development build must exercise the dimension and the models downstream of it, not only compile the edited file.
dbt build --select dim_customers+ --target ci
The trailing plus selects descendants in the model graph. Configure an isolated ci target with the required upstream relations and credentials before running this command. The selection does not automatically test every external dashboard, API, or semantic query, so add consumer checks for those contracts. See dbt selection syntax.
Acceptance check: the country fixture produces the expected grouped metric, changed column contracts pass, and a failed build prevents promotion. Keep promotion and rollback as explicit deployment steps.
Interactive Check
Question: A pull request changes dim_customers.country. Which models should CI run?
Reveal the answer
Run dim_customers, its direct downstream models, and any tests or metrics affected by country. In mature setups, state-aware selection handles this from lineage.
Practice: Design a Safe PR Gate
Choose the checks that should block a risky analytics pull request.
Use the guided lab below to record your result, assumptions, and the check that would catch an incorrect result.