Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.sqlbuild.com/llms.txt

Use this file to discover all available pages before exploring further.

Seeds are CSV files under seeds/ that SQLBuild loads as tables in the warehouse. They’re useful for small, static reference data like lookup tables, category mappings, or configuration values.

Defining a seed

Place a CSV file in your seeds/ directory:
waffle_type_id,waffle_name,category,price_cents
1,Classic Belgian,sweet,850
2,Liege,sweet,950
3,Brussels,sweet,750
4,Cheddar Herb,savory,1050
Optionally declare column types in seeds/schema.yml:
seeds:
  - name: waffle_types
    description: Waffle menu items with pricing.
    columns:
      - name: waffle_type_id
        type: INTEGER
      - name: waffle_name
        type: VARCHAR
      - name: category
        type: VARCHAR
      - name: price_cents
        type: INTEGER

Referencing seeds

Seeds are referenced in models with __ref(), the same syntax as model references:
SELECT
  o.order_id,
  w.waffle_name,
  w.price_cents * o.quantity AS line_total_cents
FROM __ref("stg_orders") o
LEFT JOIN __ref("waffle_types") w ON o.waffle_type_id = w.waffle_type_id

Loading seeds

Seeds are loaded automatically during sqb build. You can also load them standalone:
sqb --project-dir examples/waffle_shop seed
Seeds are fully replaced on every run. If the CSV changes, the table is recreated with the new data.