DBT DBT Core Concepts & Architecture 2 — Questions and Answers
Question 1: What is the purpose of the `target` key in a dbt profile?
- Specifies the file path where compiled SQL is saved
- Defines the default environment (e.g., dev or prod) to use when running dbt (Correct answer)
- Sets the maximum number of threads dbt can use
- Points to the schema.yml file for validation
Correct answer: Defines the default environment (e.g., dev or prod) to use when running dbt
The `target` key in `profiles.yml` specifies which named environment configuration (such as dev or prod) dbt uses by default when executing commands.
Question 2: What does the node selection syntax `dbt run --select +my_model` do?
- Runs my_model and all models downstream of it
- Runs my_model and all its upstream parent models (Correct answer)
- Runs only my_model, excluding any dependencies
- Runs all models except my_model
Correct answer: Runs my_model and all its upstream parent models
The `+` prefix in the selector syntax means 'include all upstream parents,' so `+my_model` runs my_model and every model it depends on.
Question 3: Which command is used to install dbt packages listed in `packages.yml`?
- dbt install
- dbt init
- dbt deps (Correct answer)
- dbt update
Correct answer: dbt deps
`dbt deps` reads `packages.yml` and downloads all listed dbt packages into the `dbt_packages/` directory.
Question 4: What does `dbt docs generate` produce?
- A compiled SQL file for each model in the project
- A catalog.json and manifest.json used to serve the documentation site (Correct answer)
- A YAML schema file based on existing database tables
- A test results report in HTML format
Correct answer: A catalog.json and manifest.json used to serve the documentation site
`dbt docs generate` creates `catalog.json` (column metadata from the warehouse) and `manifest.json` (project graph), which are used by `dbt docs serve` to render the documentation site.
Question 5: In dbt, what is an 'ephemeral' materialization?
- A model that is deleted from the database after each run
- A model that is never written to the database and exists only as a CTE in downstream models (Correct answer)
- A model stored in a temporary table and dropped after the session ends
- A model that runs only once and is never refreshed
Correct answer: A model that is never written to the database and exists only as a CTE in downstream models
Ephemeral models are not materialized in the database at all; dbt inlines them as CTEs in any downstream model that references them.
Question 6: What does `dbt debug` do?
- Shows detailed SQL output for each model as it runs
- Tests all data quality constraints defined in schema.yml
- Validates the project configuration and database connection (Correct answer)
- Displays the full DAG for the current project
Correct answer: Validates the project configuration and database connection
`dbt debug` checks that the project configuration is valid and that dbt can successfully connect to the target data warehouse using the current profile.
Question 7: Which dbt selector syntax runs a model and all models downstream of it?
- +my_model
- my_model+ (Correct answer)
- my_model*
- *my_model
Correct answer: my_model+
The trailing `+` syntax (`my_model+`) selects the specified model and all models downstream of it in the DAG.
What is the purpose of the `target` key in a dbt profile?