dbt-labs/dbt-core · error
DuckDBAdapter::list_relations_schemas_by_patterns
Error message
DuckDBAdapter::list_relations_schemas_by_patterns
What it means
DuckDB's `list_relations_schemas_by_patterns_inner` is a `todo!()` stub, so pattern-based relation/schema listing is unimplemented for DuckDBAdapter. Invoking the metadata API panics with 'DuckDBAdapter::list_relations_schemas_by_patterns'.
Source
Thrown at crates/dbt-adapter/src/metadata/duckdb/mod.rs:226
let reduce_f = |acc: &mut Acc,
key: (String, String),
schema: AdapterResult<Arc<Schema>>|
-> Result<(), Cancellable<AdapterError>> {
let (semantic_fqn, _) = key;
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!("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)
}
View on GitHub (pinned to 0267ce9170)
Solutions
- Implement the method for DuckDBAdapter using DuckDB catalog queries (e.g., duckdb_tables()/information_schema) filtered by the patterns
- Use the implemented non-pattern metadata paths for DuckDB as an interim approach
- 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!("DuckDBAdapter::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_duckdb_catalog_by_patterns(patterns, token)
} Defensive patterns
Strategy: validation
Validate before calling
if adapter.name() == "duckdb" {
return Err(anyhow!("Pattern-based relation listing is not implemented for DuckDB"));
} 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
- Avoid the pattern-listing API with DuckDB until implemented; use duckdb_tables()/information_schema directly
- Gate bulk listing flows on adapter capability checks
- Keep DuckDB workflows on the implemented metadata paths
- Track upstream DuckDB metadata implementation
When it happens
Trigger: Calling `list_relations_schemas_by_patterns` (or a flow that dispatches into this inner method) with the DuckDB adapter.
Common situations: A DuckDB project triggers a bulk schema/relation listing by patterns (e.g., cache rebuild or catalog operation) and panics the first time the pattern-based path is exercised.
Related errors
- list_relations_schemas_by_patterns for BigQuery
- ClickHouseAdapter::list_relations_schemas_by_patterns
- DatabricksAdapter::list_relations_schemas_by_patterns
- DuckDBAdapter::freshness
- Trino
AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07).
Data as JSON: /api/errors/cb13d077323f4ae2.
Report an issue: GitHub.