DBT DBT Core Concepts & Architecture 1 — Questions and Answers
Question 1: What is the primary purpose of the `ref()` function in dbt?
- To reference another dbt model and build the DAG dependency graph (Correct answer)
- To reference external database tables not managed by dbt
- To define a variable that can be reused across models
- To call a dbt macro within a SQL model
Correct answer: To reference another dbt model and build the DAG dependency graph
The `ref()` function references another dbt model and allows dbt to infer dependencies, building the correct DAG execution order automatically.
Question 2: Which file defines top-level project configuration such as model paths, project name, and version in dbt?
- profiles.yml
- schema.yml
- dbt_project.yml (Correct answer)
- packages.yml
Correct answer: dbt_project.yml
`dbt_project.yml` is the required project-level configuration file that defines project name, version, model directories, and global configurations.
Question 3: What does the `dbt compile` command do?
- Executes all models and writes results to the data warehouse
- Generates compiled SQL files without executing them against the database (Correct answer)
- Validates tests defined in schema.yml files
- Installs all packages listed in packages.yml
Correct answer: Generates compiled SQL files without executing them against the database
`dbt compile` resolves Jinja templating and `ref()` calls to produce compiled SQL in the `target/compiled/` directory without running any queries.
Question 4: In dbt, what does a DAG (Directed Acyclic Graph) represent?
- The hierarchy of database schemas used in the project
- The order of test execution across all models
- The dependency relationships and execution order between models (Correct answer)
- The branching strategy used for version control
Correct answer: The dependency relationships and execution order between models
The DAG in dbt represents the dependency graph between models, ensuring each model is built only after all its upstream dependencies are complete.
Question 5: Which command executes all dbt models in a project?
- dbt execute
- dbt build
- dbt run (Correct answer)
- dbt deploy
Correct answer: dbt run
`dbt run` executes all models in the project, materializing them in the target data warehouse according to their configured materialization type.
Question 6: What is the default materialization type for dbt models when none is explicitly configured?
- table
- ephemeral
- incremental
- view (Correct answer)
Correct answer: view
By default, dbt materializes models as views unless overridden in `dbt_project.yml` or a model's config block.
Question 7: Where are dbt connection credentials and target environment settings typically stored?
- dbt_project.yml
- profiles.yml (Correct answer)
- .env file in the project root
- schema.yml
Correct answer: profiles.yml
`profiles.yml` stores database connection credentials and target configurations, typically located in `~/.dbt/` to keep secrets out of version control.
What is the primary purpose of the `ref()` function in dbt?