sqb freshness
Observes the current data version of each source and reports whether the data has changed since the last build. Does not write any state or trigger builds.Usage
Flags
| Flag | Description |
|---|---|
--state | Compare observations against stored freshness state from the last build |
--fail-on-error | Exit with code 1 if any source observation fails or is unknown |
--fail-on-stale | Exit with code 1 if any source has changed, is unknown, or errored (requires --state) |
--virtual-env | Read previous state from the specified virtual environment instead of direct state |
--json | Output as JSON instead of human-readable text |
--json-output | Write JSON output to a file path (also prints text to stdout unless --json is set) |
--no-sql-validation | Skip compile-time SQL syntax validation |
--select, -s | Select specific sources or models (sources upstream of selected models are included) |
--exclude | Exclude specific sources or models |
Source selection
Without--select, all sources in the project are observed. When --select is provided, selectors work like other commands: you can select sources by name, or select models and their upstream sources are automatically included:
Observation without state
By default,sqb freshness observes the current data version of each source and reports what it found. No comparison is made against previous observations:
freshness: config are auto-observed using the adapter strategy if the adapter supports table metadata. Sources that can’t be observed (expression sources, managed sources without freshness config on unsupported adapters) show as unknown.
Comparing against state
Use--state to compare current observations against the freshness state stored from the last successful build:
Statuses
| Status | Meaning |
|---|---|
observed | Successfully observed (no state comparison) |
changed | Data version differs from the stored state |
unchanged | Data version matches the stored state exactly |
tolerated | Data version differs but is within the lag_tolerance threshold |
unknown | No freshness config and adapter metadata unavailable, or no previous state to compare against |
error | Observation failed (e.g. source table does not exist, query error) |
Virtual environment state
To compare against state stored in a virtual environment instead of standard mode state:CI integration
Use--fail-on-error to fail the pipeline if any source can’t be observed:
--fail-on-stale with --state to fail if any source has new data that hasn’t been built yet:
JSON output
See also
- Sources: Source freshness for freshness configuration
- Planning and Change Detection for how freshness feeds into change-aware builds

