dbt-labs/dbt-core · error

SalesforceAdapter does not implement build_schemas_from_stat

Error message

SalesforceAdapter does not implement build_schemas_from_stats_sql

What it means

build_schemas_from_stats_sql assembles CatalogTable entries from a RecordBatch returned by the stats SQL query. The Salesforce adapter does not support catalog stats collection, so this trait method is stubbed with unimplemented!() — calling it always panics. It signals that Salesforce cannot participate in the docs/catalog generation pipeline that relies on stats SQL.

Source

Thrown at crates/dbt-adapter/src/metadata/salesforce/mod.rs:34

}

impl SalesforceMetadataAdapter {
    pub fn new(engine: Arc<dyn AdapterEngine>) -> Self {
        let _adapter = AdapterImpl::new(engine, None);
        Self { /* adapter */ }
    }
}

impl MetadataAdapter for SalesforceMetadataAdapter {
    fn adapter_type(&self) -> AdapterType {
        AdapterType::Salesforce
    }

    fn build_schemas_from_stats_sql(
        &self,
        _: Arc<RecordBatch>,
    ) -> AdapterResult<BTreeMap<String, dbt_schemas::schemas::legacy_catalog::CatalogTable>> {
        unimplemented!("SalesforceAdapter does not implement build_schemas_from_stats_sql");
    }

    fn build_columns_from_get_columns(
        &self,
        _: Arc<RecordBatch>,
    ) -> AdapterResult<
        BTreeMap<String, BTreeMap<String, dbt_schemas::schemas::legacy_catalog::ColumnMetadata>>,
    > {
        unimplemented!("SalesforceAdapter does not implement build_columns_from_get_columns");
    }

    fn list_user_defined_functions_inner(
        &self,
        _catalog_schemas: &BTreeMap<String, BTreeSet<String>>,
        _token: CancellationToken,
    ) -> AsyncAdapterResult<'_, Vec<UDF>> {
        let future = std::future::ready(Ok(Default::default()));
        Box::pin(future)

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Skip catalog/stats generation for Salesforce adapter targets (exclude it from docs generate runs).
  2. Use the Salesforce adapter's supported metadata path (build_columns_from_get_columns-style describe calls) or a different discovery mechanism.
  3. If catalog support is required, implement build_schemas_from_stats_sql for SalesforceAdapter or raise an AdapterResult error instead of panicking.
Defensive patterns

Strategy: fallback

Validate before calling

if adapter.type() == "salesforce" { skip_catalog_stats_generation(); }

Type guard

fn supports_catalog_stats(t: &AdapterType) -> bool { *t != AdapterType::Salesforce }

Try / catch

// Rust callers of the trait should not catch the panic; filter adapters beforehand:
if adapter.adapter_type() != AdapterType::Salesforce {
    let tables = adapter.build_schemas_from_stats_sql(batch)?;
}

Prevention

When it happens

Trigger: Running catalog/docs generation (dbt docs generate) or any metadata pipeline that calls SalesforceAdapter::build_schemas_from_stats_sql, since the Salesforce adapter never implements stats-based schema building.

Common situations: Running 'dbt docs generate' against a Salesforce adapter profile; tooling that harvests catalog metadata from all configured adapters including Salesforce; automation that assumes every adapter supports the stats SQL catalog path.

Related errors


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