DBT DBT Sources & Seeds 2 — Questions and Answers
Question 1: How do you reference a seed table inside a dbt model?
- {{ seed('seed_name') }}
- {{ source('seeds', 'seed_name') }}
- {{ ref('seed_name') }} (Correct answer)
- {{ table('seed_name') }}
Correct answer: {{ ref('seed_name') }}
Seeds are treated like models in the DAG, so you reference them with `{{ ref('seed_name') }}` just like any model.
Question 2: Where are source definitions typically stored in a dbt project?
- In dbt_project.yml
- In YAML files within the models/ directory (Correct answer)
- In a dedicated sources.yml at the project root
- In the macros/ directory
Correct answer: In YAML files within the models/ directory
Sources are declared in any YAML file inside the models/ directory tree (e.g., sources.yml or staging/sources.yml).
Question 3: What does the `loaded_at_field` property on a source table specify?
- The column that holds the row's creation timestamp for freshness checks (Correct answer)
- The field used to partition the source table
- The primary key of the source
- The field mapped to the dbt surrogate key
Correct answer: The column that holds the row's creation timestamp for freshness checks
`loaded_at_field` points to a timestamp column that dbt checks to determine how recently data was loaded.
Question 4: Which config key in dbt_project.yml sets the schema for all seed tables?
- seeds > +schema (Correct answer)
- seeds > +database
- seeds > +target_schema
- seeds > +materialized
Correct answer: seeds > +schema
Under the `seeds:` block in dbt_project.yml, `+schema` overrides the default schema for seed output tables.
Question 5: What happens when you run `dbt seed --full-refresh`?
- Only new CSV rows are appended
- The seed table is dropped and recreated from scratch (Correct answer)
- Indexes are rebuilt
- Source tables are re-imported
Correct answer: The seed table is dropped and recreated from scratch
`--full-refresh` causes dbt to drop the existing seed table before recreating it, ensuring a clean load.
Question 6: Which dbt source property lets you override the actual database table name that a source points to?
- alias
- identifier (Correct answer)
- table_name
- override
Correct answer: identifier
The `identifier:` property under a source table lets you specify the real table name in the warehouse when it differs from the dbt source name.
How do you reference a seed table inside a dbt model?