0
0
dbtdata~30 mins

Loading CSV seeds in dbt - Mini Project: Build & Apply

Choose your learning style9 modes available
Loading CSV seeds in dbt
📖 Scenario: You are working on a data project where you need to load a small CSV file containing product information into your dbt project. This will help you use this data in your transformations and analyses.
🎯 Goal: Learn how to load a CSV file as a seed in dbt and access it in your models.
📋 What You'll Learn
Create a CSV seed file with exact product data
Configure the seed in dbt_project.yml
Run the seed command to load data
Write a simple model to select data from the seed
💡 Why This Matters
🌍 Real World
Loading small reference data or lookup tables as seeds is common in data projects to enrich analytics.
💼 Career
Data engineers and analysts use dbt seeds to manage static data easily within their transformation workflows.
Progress0 / 4 steps
1
Create the CSV seed file
Create a CSV file named products.csv inside the seeds folder of your dbt project. The CSV file should have these exact contents including the header:

product_id,product_name,price 1,Apple,0.5 2,Banana,0.3 3,Cherry,0.2
dbt
Need a hint?

Make sure the file is named exactly products.csv and placed inside the seeds folder.

2
Configure the seed in dbt_project.yml
Add a seed configuration in your dbt_project.yml file to set +header: true for the products seed. This tells dbt that your seed file has a header row.
dbt
Need a hint?

Replace your_project_name with your actual dbt project name.

3
Run the seed command to load data
Run the dbt seed command in your terminal to load the CSV data into your data warehouse. Use the exact command dbt seed.
dbt
Need a hint?

Open your terminal and type dbt seed to load the CSV data.

4
Create a model to select data from the seed and display output
Create a model SQL file named select_products.sql in your models folder with this exact content:

select * from {{ ref('products') }}

Then run dbt run and print the output of the model query to see the loaded seed data.
dbt
Need a hint?

Make sure the model file is named exactly select_products.sql and placed in the models folder.