Given a dbt seed file products.csv with 3 rows, and an incremental model that selects all rows from this seed, what will be the number of rows in the model after two runs if the seed file is unchanged?
models/incremental_products.sql
{{ config(materialized='incremental', unique_key='product_id') }}
select * from {{ ref('products') }}Think about how incremental models handle existing rows with the same unique key.
Incremental models add new rows or update existing rows based on the unique key. Since the seed file is unchanged, no new rows are added, so the model remains with 3 rows.
You have a seed CSV file sales.csv with columns date, amount. You create a dbt model that loads this seed and adds a new column amount_taxed which is amount * 1.1. What is the output table if the seed has rows:
date,amount 2024-01-01,100 2024-01-02,200
select date, amount, amount * 1.1 as amount_taxed from {{ ref('sales') }}
Remember to multiply the amount by 1.1 to get amount_taxed.
The amount_taxed column is calculated by multiplying amount by 1.1, so 100 becomes 110.0 and 200 becomes 220.0.
Consider this dbt seed configuration in dbt_project.yml:
seeds:
my_project:
sales:
file: sales_data.csv
delimiter: ';'
header: falseWhat error will occur when running dbt seed?
Check the valid configuration keys for seeds in dbt.
The 'file' key is not a valid configuration option for seeds in dbt. The seed filename is determined by the CSV file name in the seeds folder, not by config.
When you run dbt seed multiple times without changing the CSV file, what happens to the data in the database table created by the seed?
Think about how dbt seed manages the target table on each run.
dbt seed drops and recreates the table on each run, so the data always matches the CSV file exactly, replacing any existing data.
You have a seed CSV users.csv with columns id, name, age:
id,name,age 1,Alice,30 2,Bob, 3,Charlie,25
You load this seed in dbt and run a model that selects all rows where age > 25. What rows will the model return?
select * from {{ ref('users') }} where age > 25
Remember that null values do not satisfy comparison operators like >.
Only Alice has age 30 which is greater than 25. Bob's age is null and does not satisfy the condition. Charlie's age is 25, which is not greater than 25.