{"record":{"id":"8b47a8322a4b73f9","repo":"dbt-labs/dbt-core","slug":"only-available-with-databricksadapter","errorCode":null,"errorMessage":"only available with Databricksadapter","messagePattern":"only available with Databricksadapter","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/adapter/adapter_impl.rs","lineNumber":4185,"sourceCode":"                let query_ctx =\n                    query_ctx_from_state(state)?.with_desc(\"compare_dbr_version adapter call\");\n\n                let current_version =\n                    DatabricksMetadataAdapter::get_engine_version(self, &query_ctx, conn, token)?;\n                let expected_version = EngineVersion::Full(major, minor);\n\n                let result = match current_version.cmp(&expected_version) {\n                    std::cmp::Ordering::Greater => 1,\n                    std::cmp::Ordering::Equal => 0,\n                    std::cmp::Ordering::Less => -1,\n                };\n\n                Ok(Value::from(result))\n            }\n            Postgres | Snowflake | Bigquery | Redshift | Salesforce | Spark | DuckDB\n            | LakeCompute | Fabric | ClickHouse | Exasol | Starburst | Athena | Trino\n            | Datafusion | Dremio | Oracle => {\n                unimplemented!(\"only available with Databricksadapter\")\n            }\n        }\n    }\n\n    /// Get the external root directory from engine config, defaulting to `\".\"`.\n    pub fn external_root(&self) -> String {\n        self.engine()\n            .config(\"external_root\")\n            .unwrap_or(Cow::Borrowed(\".\"))\n            .into_owned()\n    }\n\n    /// Build the write-options string for DuckDB external materializations.\n    pub fn external_write_options(&self, write_location: &str, rendered_options: &Value) -> String {\n        let mut opts: IndexMap<String, String> = IndexMap::new();\n        if let Ok(keys) = rendered_options.try_iter() {\n            for key in keys {\n                let key_str = key.to_string();","sourceCodeStart":4167,"sourceCodeEnd":4203,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/adapter/adapter_impl.rs#L4167-L4203","documentation":"compare_dbr_version compares the current Databricks Runtime version against a given major/minor and returns -1/0/1; it exists only on the Databricks adapter (dbt-databricks impl.py#L349). Any other adapter type hits the unimplemented!() arm and panics, since DBR versioning is a Databricks-only concept.","triggerScenarios":"Calling adapter.compare_dbr_version(state, conn, major, minor, token) while adapter_type() is Postgres, Snowflake, Bigquery, Redshift, Spark, DuckDB, or any other non-Databricks adapter. Note this is typically invoked from Databricks materialization macros (e.g. uniform/iceberg checks).","commonSituations":"A Databricks-specific macro from dbt-databricks runs in a project whose active target is another warehouse; a shared macro bundle executes DBR capability checks unconditionally; the model's selected profile points at the wrong adapter.","solutions":["Guard with `{% if adapter.type() == 'databricks' %}` before any compare_dbr_version call","Fix the target/profile so the Databricks adapter is selected when running Databricks materializations","For other platforms, remove DBR-version-dependent logic or replace with platform-appropriate checks"],"exampleFix":"{% if adapter.type() == 'databricks' %}\n  {% set cmp = adapter.compare_dbr_version(14, 3) %}\n{% endif %}","handlingStrategy":"type-guard","validationCode":"{% if adapter.type() == 'databricks' %}\n  {% set cmp = adapter.compare_dbr_version(14, 3) %}\n{% endif %}","typeGuard":"fn is_databricks(adapter: &AdapterImpl) -> bool { adapter.adapter_type() == AdapterType::Databricks }","tryCatchPattern":"// Panic-based unimplemented!; guard before invoking\nif adapter.adapter_type() == AdapterType::Databricks {\n    let cmp = adapter.compare_dbr_version(state, conn, major, minor, token)?;\n}","preventionTips":["Wrap Databricks-only version checks in adapter.type() guards","Exclude Databricks macros from non-Databricks materialization search paths","Verify the active dbt target in CI pipelines before running"],"tags":["adapter","databricks","dbr-version","unimplemented"],"backgroundTag":"operation-not-supported","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}