{"record":{"id":"c332b64d22372241","repo":"dbt-labs/dbt-core","slug":"supports-create-or-replace-is-not-implemented-for","errorCode":null,"errorMessage":"supports_create_or_replace is not implemented for {:?}","messagePattern":"supports_create_or_replace is not implemented for (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/catalog_relation.rs","lineNumber":1479,"sourceCode":"            base_location: None,\n            adapter_properties: BTreeMap::new(),\n            is_transient: Some(true),\n            file_format: None,\n        }\n    }\n\n    // === end HACK\n\n    pub fn supports_create_or_replace(&self) -> bool {\n        match self.adapter_type {\n            AdapterType::Databricks => {\n                self.table_format.is_iceberg()\n                    || self\n                        .file_format\n                        .as_deref()\n                        .is_some_and(|f| f.eq_ignore_ascii_case(\"delta\"))\n            }\n            _ => unimplemented!(\n                \"supports_create_or_replace is not implemented for {:?}\",\n                self.adapter_type\n            ),\n        }\n    }\n\n    // helper for get_value in impl Object\n    fn gate_by_adapter(\n        &self,\n        adapter_types: Vec<AdapterType>,\n        value_fetch: impl Fn() -> Value,\n    ) -> Value {\n        if adapter_types.contains(&self.adapter_type) {\n            value_fetch()\n        } else {\n            Value::from(())\n        }\n    }","sourceCodeStart":1461,"sourceCodeEnd":1497,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/catalog_relation.rs#L1461-L1497","documentation":"`CatalogRelation::supports_create_or_replace` is only implemented for the Databricks adapter type (true for Iceberg table format or Delta file format); any other `adapter_type` stored on the relation hits `unimplemented!` and panics. The method encodes a per-adapter capability question that simply has no answer coded for other warehouses yet. It is a code-completeness gap, not a reflection of whether your actual table supports CREATE OR REPLACE.","triggerScenarios":"Calling `catalog_relation.supports_create_or_replace()` on a CatalogRelation whose `adapter_type` is anything other than Databricks — e.g. Snowflake or BigQuery relations built by macros that then probe create-or-replace support.","commonSituations":"Materialization macros that probe create-or-replace support across warehouses; building a CatalogRelation with a non-Databricks adapter_type and reusing Databricks-era helper code; tests constructing relations with default adapter types.","solutions":["Only call supports_create_or_replace on Databricks catalog relations; for other adapters use their native create-or-replace semantics (most support it directly).","Extend the match in catalog_relation.rs to return the appropriate boolean for your adapter type instead of panicking.","Guard call sites with a check that the relation's adapter_type is Databricks and fall back to a default assumption otherwise."],"exampleFix":"// before\nlet ok = relation.supports_create_or_replace();\n// after\nlet ok = match relation.adapter_type {\n    AdapterType::Databricks => relation.supports_create_or_replace(),\n    _ => true, // most warehouses support create or replace natively\n};","handlingStrategy":"type-guard","validationCode":"// Rust\nfn create_or_replace_known(t: &AdapterType) -> bool {\n    matches!(t, AdapterType::Databricks)\n}","typeGuard":"let supports = if relation.adapter_type == AdapterType::Databricks {\n    relation.supports_create_or_replace()\n} else { true };","tryCatchPattern":"// No catch possible; narrow before the call\nmatch relation.adapter_type {\n    AdapterType::Databricks => relation.supports_create_or_replace(),\n    _ => true,\n}","preventionTips":["Only query capability methods on relations whose adapter_type matches the implemented set","Extend supports_create_or_replace when adding adapter support","Keep CatalogRelation construction and its capability queries in the same adapter context"],"tags":["unimplemented","catalog-relation","databricks","adapter"],"backgroundTag":"method-not-implemented","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}