dbt-labs/dbt-core · error

constraint support not implemented

Error message

constraint support not implemented

What it means

get_constraint_support panics for adapters whose constraint-support matrix has no entries (Salesforce, Spark, Starburst, Athena, Trino, Datafusion, Dremio, Oracle). The function classifies whether each constraint type (Check, NotNull, Unique, PrimaryKey, ForeignKey, Custom) is Enforced/Assumed/NotSupported for a given adapter; these adapters lack a mapping in the Rust port.

Source

Thrown at crates/dbt-adapter/src/adapter/adapter_impl.rs:2835

            (Fabric, PrimaryKey) => Enforced,
            (Fabric, ForeignKey) => Enforced,
            (Fabric, Custom) => NotSupported,

            // Exasol (verified on Exasol 8)
            (Exasol, NotNull) => Enforced,
            (Exasol, PrimaryKey) => Enforced,
            (Exasol, ForeignKey) => Enforced,
            (Exasol, Unique) => NotSupported,
            (Exasol, Check) => NotSupported,
            (Exasol, Custom) => NotSupported,

            // ClickHouse (dbt-clickhouse impl.py CONSTRAINT_SUPPORT)
            (ClickHouse, Check) => Enforced,
            (ClickHouse, NotNull | Unique | PrimaryKey | ForeignKey | Custom) => NotSupported,

            // Salesforce
            (Salesforce | Spark | Starburst | Athena | Trino | Datafusion | Dremio | Oracle, _) => {
                unimplemented!("constraint support not implemented")
            }
        }
    }

    /// Given existing columns and columns from our model
    /// we determine which columns to update and persist docs for
    pub fn do_get_persist_doc_columns(
        &self,
        existing_columns: Vec<Column>,
        model_columns: IndexMap<String, DbtColumnRef>,
    ) -> AdapterResult<IndexMap<String, DbtColumnRef>> {
        if self.adapter_type() != Databricks {
            return Err(AdapterError::new(
                AdapterErrorKind::NotSupported,
                "get_persist_doc_columns is a Databricks adapter operation",
            ));
        }
        // Upstream semantics (dbt-databricks): persist a column doc update if and only if the

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Remove constraints/contract enforcement from models on these adapters.
  2. Switch to an adapter with a defined constraint matrix (Postgres, Snowflake, BigQuery, Databricks, Redshift, DuckDB, ClickHouse, etc.).
  3. Add the missing match arm mapping each constraint type to Enforced/NotSupported for these adapters.

Example fix

// before
(Salesforce | Spark | Starburst | Athena | Trino | Datafusion | Dremio | Oracle, _) => {
    unimplemented!("constraint support not implemented")
}
// after
(Salesforce | Spark | Starburst | Athena | Trino | Datafusion | Dremio | Oracle, _) => NotSupported,
Defensive patterns

Strategy: validation

Validate before calling

const CONSTRAINT_ADAPTERS: &[&str] = &["postgres","snowflake","bigquery","databricks","redshift","duckdb","clickhouse"];
if model.constraints.is_some() && !CONSTRAINT_ADAPTERS.contains(&adapter_type.as_str()) {
    return Err("constraints not supported for this adapter".into());
}

Type guard

fn supports_constraints(adapter_type: &AdapterType) -> bool {
    !matches!(adapter_type, AdapterType::Salesforce | AdapterType::Spark | AdapterType::Starburst | AdapterType::Athena | AdapterType::Trino | AdapterType::Datafusion | AdapterType::Dremio | AdapterType::Oracle)
}

Prevention

When it happens

Trigger: Rendering model constraints via render_raw_columns_constraints or render_column_constraint (both call this) while the active adapter is Salesforce, Spark, Starburst, Athena, Trino, Datafusion, Dremio, or Oracle.

Common situations: Declaring `constraints` blocks (or `contract: {enforced: true}`) on models run with any of the unported adapters.

Related errors


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