Skip to main content

04. Seeds Use Cases

Why Use Seeds?​

Seeds are useful for static reference data and business logic tables that do not change frequently.
They allow you to store small datasets inside your dbt project and load them into your warehouse easily.


Common Use Cases for Seeds​

Use the table below as a quick reference for where seeds are most useful in a dbt project:

PurposeDescription
Reference DataStore static lookup data such as Country Codes, Currency Codes, Status Codes, etc.
Configuration DataStore business configuration values that rarely change.
Mapping TablesMaintain mappings such as Source System → Target System, Product Code → Product Category.
Test DataLoad sample datasets for development and testing.
StandardizationKeep common lookup data under version control with the dbt project.

1️⃣ Country & Currency Reference​

  • Example: Mapping ISO country codes or currency codes to names.
country_code,country_name
US,United States
IN,India
UK,United Kingdom

2️⃣ Mapping Tables for Business Logic​

  • For categorizing data:
product_id,category
101,Electronics
102,Clothing
103,Books

3️⃣ Static Configuration Tables​

  • Example: Thresholds, weights, or flags used in models.
metric,threshold
sales_target,50000
profit_margin,0.20

4️⃣ Hierarchy or Classification Data​

  • Storing organization structures, product hierarchies, etc.
dept_id,dept_name,parent_dept
10,Finance,NULL
20,Accounting,10
30,Payroll,10

5️⃣ Data Quality Rules​

  • Define validation rules as seeds for dynamic testing.
column_name,rule
customer_id,not_null
order_amount,positive

When NOT to Use Seeds​

Large datasets (use external tables instead) Frequently changing data (use staging tables or ETL pipelines)


Best Practices for Seeds​

Keep seed files small ( < 1 MB) Document each seed in schema.yml Apply tests for quality checks Store them in data\ folder with meaningful names


Summary​

Seeds are best for static, version-controlled data that supports lookups, mappings, and business logic without additional ETL overhead.