DBT DBT Deployment & CI/CD 2 — Questions and Answers
Question 1: Which file defines the target warehouse connection details for a dbt Core project?
- dbt_project.yml
- profiles.yml (Correct answer)
- sources.yml
- connections.yml
Correct answer: profiles.yml
`profiles.yml` (stored in `~/.dbt/` by default) holds named targets with adapter type, credentials, and warehouse-specific settings.
Question 2: What does `dbt run --target prod` do?
- Deploys models to a production server
- Switches to the `prod` target defined in profiles.yml (Correct answer)
- Tags all models with 'prod'
- Enables production-only materializations
Correct answer: Switches to the `prod` target defined in profiles.yml
The `--target` flag selects a named output target from profiles.yml, allowing the same project to run against dev or prod warehouses.
Question 3: Which dbt Cloud concept separates the environment where CI tests run from where production runs land?
- Workspaces
- Environments (Correct answer)
- Namespaces
- Tenants
Correct answer: Environments
dbt Cloud Environments (e.g., 'CI', 'Production') hold distinct connection credentials, dbt versions, and custom schemas for isolation.
Question 4: What does the `+schema` config in dbt_project.yml do when set for a model folder?
- Sets the source schema to read from
- Appends a custom suffix to the target schema for that folder's models (Correct answer)
- Renames the model
- Locks the schema from future changes
Correct answer: Appends a custom suffix to the target schema for that folder's models
`+schema` defines a custom schema suffix that dbt appends to the target schema, allowing logical separation (e.g., `dbt_<user>_staging`).
Question 5: In GitHub Actions, which `dbt run` flag would you add to run only models changed in a PR versus the production manifest?
- --select state:modified+ --defer --state ./prod-manifest (Correct answer)
- --select changed:true
- --modified-only
- --select pr:changed
Correct answer: --select state:modified+ --defer --state ./prod-manifest
Combining `state:modified+` (changed model plus its downstream dependents), `--defer`, and `--state` pointing to the production manifest implements Slim CI.
Question 6: What dbt Cloud feature lets a CI job use prod table results for unmodified models instead of rebuilding them?
- State comparison
- Deferral (Correct answer)
- Model caching
- Run bypass
Correct answer: Deferral
Deferral (`--defer`) tells dbt to use a different environment's tables for refs that are not being rebuilt in the current run.
Which file defines the target warehouse connection details for a dbt Core project?