DBT DBT Deployment & CI/CD 1 — Questions and Answers
Question 1: What is the purpose of dbt Cloud's Slim CI feature?
- Compiles dbt models without running them
- Runs only models that have changed since the last successful job (Correct answer)
- Reduces Cloud plan costs automatically
- Minifies generated SQL for faster queries
Correct answer: Runs only models that have changed since the last successful job
Slim CI uses the `state:modified` selector with a deferred environment to run only the models impacted by a pull request, saving time and cost.
Question 2: Which selector is used in dbt to run only models that differ from a previous state manifest?
- --select changed
- --select state:modified (Correct answer)
- --select diff:new
- --select modified:true
Correct answer: --select state:modified
`state:modified` compares the project against a baseline manifest.json to identify nodes with code or config changes.
Question 3: What environment variable or flag tells dbt where to find the baseline manifest for state comparison?
- --state or DBT_STATE (Correct answer)
- --manifest-path
- --baseline-dir
- DBT_MANIFEST
Correct answer: --state or DBT_STATE
The `--state` flag (or `DBT_STATE` env var) specifies the directory containing the `manifest.json` to use as the comparison baseline.
Question 4: In a dbt Cloud job, what does enabling 'Generate docs' do?
- Publishes docs to a public URL automatically
- Runs `dbt docs generate` to refresh the catalog artifact after the run (Correct answer)
- Sends documentation to Confluence
- Adds doc() blocks to all models
Correct answer: Runs `dbt docs generate` to refresh the catalog artifact after the run
The 'Generate docs' toggle appends a `dbt docs generate` step to the job, refreshing the catalog.json and making docs available in dbt Cloud.
Question 5: Which dbt Core command compiles SQL without executing it against the warehouse?
- dbt parse
- dbt compile (Correct answer)
- dbt dry-run
- dbt validate
Correct answer: dbt compile
`dbt compile` resolves all Jinja and ref/source calls and writes the compiled SQL to the `target/compiled/` directory without running queries.
Question 6: What is the recommended way to handle secrets (e.g., database passwords) in a dbt CI pipeline?
- Store them in profiles.yml committed to the repo
- Use environment variables injected by the CI platform (Correct answer)
- Hardcode them in dbt_project.yml
- Store them in a seed CSV
Correct answer: Use environment variables injected by the CI platform
Secrets should be passed as environment variables from the CI platform (GitHub Actions, GitLab CI, etc.) and referenced in profiles.yml using `env_var()`.
What is the purpose of dbt Cloud's Slim CI feature?