dbt-labs/dbt-core · error

ClickHouseAdapter::list_relations_schemas_by_patterns

Error message

ClickHouseAdapter::list_relations_schemas_by_patterns

What it means

ClickHouse's `list_relations_schemas_by_patterns_inner` is a `todo!()` placeholder, so pattern-based relation/schema listing is not implemented for ClickHouseAdapter. Calling the corresponding metadata API panics with the message 'ClickHouseAdapter::list_relations_schemas_by_patterns'.

Source

Thrown at crates/dbt-adapter/src/metadata/clickhouse/mod.rs:264

                        schema: AdapterResult<Arc<Schema>>|
         -> Result<(), Cancellable<AdapterError>> {
            let (semantic_fqn, _sql_name) = key;
            // Insert under the semantic FQN so callers using `schemas.get(&relation.semantic_fqn())`
            // can find the entry.
            acc.insert(semantic_fqn, schema);
            Ok(())
        };

        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)
    }

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Implement the method for ClickHouseAdapter, e.g., querying `system.tables`/`system.columns` filtered by the patterns
  2. Fall back to per-database/per-relation metadata calls that are implemented for ClickHouse
  3. Track the missing feature upstream

Example fix

// before
fn list_relations_schemas_by_patterns_inner(
    &self,
    _patterns: &[RelationPattern],
    _token: CancellationToken,
) -> AsyncAdapterResult<'_, Vec<(String, AdapterResult<RelationSchemaPair>)>> {
    todo!("ClickHouseAdapter::list_relations_schemas_by_patterns")
}
// after
fn list_relations_schemas_by_patterns_inner(
    &self,
    patterns: &[RelationPattern],
    token: CancellationToken,
) -> AsyncAdapterResult<'_, Vec<(String, AdapterResult<RelationSchemaPair>)>> {
    self.query_system_tables_by_patterns(patterns, token)
}
Defensive patterns

Strategy: validation

Validate before calling

if adapter.name() == "clickhouse" {
    return Err(anyhow!("Pattern-based relation listing is not implemented for ClickHouse"));
}

Type guard

fn supports_pattern_listing(adapter: &dyn Adapter) -> bool {
    adapter.capabilities().list_relations_schemas_by_patterns
}

Try / catch

match std::panic::catch_unwind(AssertUnwindSafe(|| adapter.list_relations_schemas_by_patterns(patterns))) {
    Ok(res) => res,
    Err(_) => per_relation_listing_fallback(patterns),
}

Prevention

When it happens

Trigger: Invoking `list_relations_schemas_by_patterns` (or any caller that dispatches into this inner method) while connected via the ClickHouse adapter.

Common situations: A ClickHouse project triggers a bulk schema refresh or relations cache rebuild that uses the pattern-based listing API; the panic fires the first time that flow runs.

Related errors


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/310899394cea1bb7. Report an issue: GitHub.