dbt-labs/dbt-core · error
ClickHouseAdapter::freshness
Error message
ClickHouseAdapter::freshness
What it means
ClickHouse's `freshness_inner` is a `todo!()` stub in the metadata trait implementation, so source freshness checks are unimplemented for ClickHouseAdapter. Calling the freshness metadata API panics with 'ClickHouseAdapter::freshness'.
Source
Thrown at crates/dbt-adapter/src/metadata/clickhouse/mod.rs:272
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!("ClickHouseAdapter::list_relations_schemas_by_patterns")
}
fn freshness_inner(
&self,
_relations: &[Arc<dyn BaseRelation>],
_token: CancellationToken,
) -> AsyncAdapterResult<'_, BTreeMap<String, MetadataFreshness>> {
todo!("ClickHouseAdapter::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 ClickHouseAdapter, e.g., reading timestamps from ClickHouse freshness/system tables for the given relations
- Skip freshness collection for ClickHouse or gate the freshness flow behind a capability check until implemented
- Track the missing feature upstream
Example fix
// before
fn freshness_inner(
&self,
_relations: &[Arc<dyn BaseRelation>],
_token: CancellationToken,
) -> AsyncAdapterResult<'_, BTreeMap<String, MetadataFreshness>> {
todo!("ClickHouseAdapter::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() == "clickhouse" {
return Err(anyhow!("Freshness is not implemented for ClickHouse"));
} 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
- Check freshness support per adapter before scheduling freshness runs
- Skip freshness collection for adapters without freshness_inner implemented
- Surface freshness as 'unknown' instead of calling an unimplemented API
- Track upstream ClickHouse freshness support
When it happens
Trigger: Invoking the metadata freshness API (which dispatches to `freshness_inner`) against a ClickHouse adapter, e.g., when computing freshness of relations via `*_freshness` metadata tables.
Common situations: Running source freshness checks in a ClickHouse-configured project; the panic occurs the first time freshness is requested for any relation.
Related errors
- ClickHouseAdapter::list_relations_schemas_by_patterns
- DuckDBAdapter::freshness
- 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/73beaf993dddba51.
Report an issue: GitHub.