dbt-labs/dbt-core · error
DuckDBAdapter::freshness
Error message
DuckDBAdapter::freshness
What it means
DuckDB's `freshness_inner` is a `todo!()` placeholder in the metadata trait implementation, so relation freshness checks are unimplemented for DuckDBAdapter. Calling the freshness API panics with 'DuckDBAdapter::freshness'.
Source
Thrown at crates/dbt-adapter/src/metadata/duckdb/mod.rs:234
let map_reduce = MapReduce::new(factory, Box::new(map_f), Box::new(reduce_f), None);
map_reduce.run(Arc::new(keys), token)
}
fn list_relations_schemas_by_patterns_inner(
&self,
_patterns: &[RelationPattern],
_token: CancellationToken,
) -> AsyncAdapterResult<'_, Vec<(String, AdapterResult<RelationSchemaPair>)>> {
todo!("DuckDBAdapter::list_relations_schemas_by_patterns")
}
fn freshness_inner(
&self,
_relations: &[Arc<dyn BaseRelation>],
_token: CancellationToken,
) -> AsyncAdapterResult<'_, BTreeMap<String, MetadataFreshness>> {
todo!("DuckDBAdapter::freshness")
}
fn create_schemas_if_not_exists(
&self,
state: &State<'_, '_>,
catalog_schemas: Vec<(String, String, String)>,
) -> AdapterResult<Vec<(String, String, String, AdapterResult<()>)>> {
create_schemas_if_not_exists(&self.adapter, self, state, catalog_schemas)
}
fn list_relations_in_parallel_inner(
&self,
db_schemas: &[CatalogAndSchema],
token: CancellationToken,
) -> AsyncAdapterResult<'_, BTreeMap<CatalogAndSchema, AdapterResult<RelationVec>>> {
type Acc = BTreeMap<CatalogAndSchema, AdapterResult<RelationVec>>;
let factory = Box::new(AdapterConnectionFactory::new(View on GitHub (pinned to 0267ce9170)
Solutions
- Implement `freshness_inner` for DuckDBAdapter by querying the relevant metadata/timestamp tables for the given relations
- Skip or disable freshness collection for DuckDB until the implementation exists
- Track the missing feature upstream
Example fix
// before
fn freshness_inner(
&self,
_relations: &[Arc<dyn BaseRelation>],
_token: CancellationToken,
) -> AsyncAdapterResult<'_, BTreeMap<String, MetadataFreshness>> {
todo!("DuckDBAdapter::freshness")
}
// after
fn freshness_inner(
&self,
relations: &[Arc<dyn BaseRelation>],
token: CancellationToken,
) -> AsyncAdapterResult<'_, BTreeMap<String, MetadataFreshness>> {
self.query_freshness(relations, token)
} Defensive patterns
Strategy: validation
Validate before calling
if adapter.name() == "duckdb" {
return Err(anyhow!("Freshness is not implemented for DuckDB"));
} Type guard
fn supports_freshness(adapter: &dyn Adapter) -> bool {
adapter.capabilities().freshness
} Try / catch
match std::panic::catch_unwind(AssertUnwindSafe(|| adapter.freshness(relations))) {
Ok(map) => map,
Err(_) => BTreeMap::new(),
} Prevention
- Skip freshness collection for DuckDB until freshness_inner is implemented
- Check adapter capabilities before scheduling freshness runs
- Treat freshness as 'unknown' for unsupported adapters
- Track upstream DuckDB freshness support
When it happens
Trigger: Invoking the metadata freshness API (dispatching to `freshness_inner`) against a DuckDB adapter, e.g., during source freshness collection.
Common situations: Running a source freshness flow in a DuckDB-configured project; the panic occurs the first time freshness metadata is requested.
Related errors
- ClickHouseAdapter::freshness
- DuckDBAdapter::list_relations_schemas_by_patterns
- PostgresAdapter::freshness
- load_dataframe() for the Salesforce adapter
- list_relations_schemas_by_patterns for BigQuery
AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07).
Data as JSON: /api/errors/d8249a4d34ff116a.
Report an issue: GitHub.