How to Use dbt Sources
Last updated July 25, 2026 · By the SaturnSQL team
Declare raw tables in a YAML sources block, then reference them with {{ source('source_name', 'table_name') }}. Sources make raw dependencies explicit in the DAG, can carry tests, and support freshness checks via dbt source freshness.
# models/staging/sources.yml
sources:
- name: shop
database: raw
schema: shop_data
tables:
- name: raw_orders
loaded_at_field: _loaded_at
freshness:
warn_after: {count: 12, period: hour}
error_after: {count: 24, period: hour}In a model
SELECT * FROM {{ source('shop', 'raw_orders') }}Checking freshness
dbt source freshnessRun this in SaturnSQL
SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.
Try it free