Source freshness checks help you know if your data is up-to-date. They tell you when the data was last updated so you can trust your reports.
Source freshness checks in dbt
sources:
- name: your_source_name
tables:
- name: your_table_name
freshness:
warn_after:
count: 24
period: hour
error_after:
count: 48
period: hourwarn_after sets when dbt should warn you if data is too old.
error_after sets when dbt should stop the run and show an error if data is too old.
sources:
- name: sales_data
tables:
- name: sales_data
freshness:
warn_after:
count: 12
period: hour
error_after:
count: 24
period: hoursources:
- name: user_events
tables:
- name: user_events
freshness:
warn_after:
count: 1
period: day
error_after:
count: 2
period: dayThis dbt source config checks the freshness of the 'orders' table in 'my_source'. It warns if data is older than 6 hours and errors if older than 12 hours.
version: 2 sources: - name: my_source tables: - name: orders freshness: warn_after: count: 6 period: hour error_after: count: 12 period: hour
Freshness checks require your source tables to have a timestamp column that shows when data was last updated.
You can run freshness checks separately using dbt source freshness command.
Set warn_after and error_after based on how often your data updates in real life.
Source freshness checks help you track how recent your data is.
Use warn_after and error_after to set thresholds for alerts and errors.
Run freshness checks regularly to keep your data trustworthy.