{"record":{"id":"b7c9779d5241b5fe","repo":"dbt-labs/dbt-core","slug":"render-for-create-is-only-available-for-databricks","errorCode":null,"errorMessage":"render_for_create is only available for Databricks/Spark","messagePattern":"render_for_create is only available for Databricks/Spark","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/column/types.rs","lineNumber":1073,"sourceCode":"    /// Returns e.g. `` `col` BIGINT NOT NULL COMMENT 'comment' ``\n    ///\n    /// Reference: https://github.com/databricks/dbt-databricks/blob/822b105b15e644676d9e1f47cbfd765cd4c1541f/dbt/adapters/databricks/column.py#L167-L179\n    pub fn render_for_create(&self) -> String {\n        match self._adapter_type {\n            AdapterType::Databricks | AdapterType::Spark => {\n                let mut s = format!(\"{} {}\", self.quoted(), self.data_type());\n                if self._nullable == Some(false) {\n                    s.push_str(\" NOT NULL\");\n                }\n                if let Some(comment) = &self.comment\n                    && !comment.is_empty()\n                {\n                    let escaped = comment.replace('\\\\', \"\\\\\\\\\").replace('\\'', \"\\\\'\");\n                    s.push_str(&format!(\" COMMENT '{escaped}'\"));\n                }\n                s\n            }\n            _ => unimplemented!(\"render_for_create is only available for Databricks/Spark\"),\n        }\n    }\n\n    pub fn char_size(&self) -> Option<u32> {\n        self.char_size\n    }\n\n    pub fn numeric_precision(&self) -> Option<u64> {\n        self.numeric_precision\n    }\n\n    pub fn numeric_scale(&self) -> Option<u64> {\n        self.numeric_scale\n    }\n\n    pub fn collation(&self) -> Option<&str> {\n        self.collation.as_deref()\n    }","sourceCodeStart":1055,"sourceCodeEnd":1091,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/column/types.rs#L1055-L1091","documentation":"render_for_create renders the column type (including COMMENT clauses) for CREATE TABLE/AS SELECT statements. Only the Databricks and Spark renderers are implemented; any other adapter type falls into the match's catch-all arm and panics with unimplemented!(). It exists because dbt-databricks/dbt-spark need custom type-and-comment rendering during table creation.","triggerScenarios":"Invoking DbtColumn::render_for_create while adapter_type is anything besides Databricks or Spark — e.g. rendering column DDL on Postgres, Snowflake, Redshift, or BigQuery.","commonSituations":"A table-creation macro (e.g. custom create_table_as or column comment handling) that calls render_for_create regardless of platform; porting Spark/Databricks model DDL generation to another adapter; tests constructing columns without setting the adapter type.","solutions":["Gate the call on adapter type: only render_for_create for Databricks/Spark; use standard type_sql()/DDL rendering elsewhere.","For non-Databricks platforms, render the column type via the adapter's default Column::type rendering and append comments with the platform's own syntax.","If Spark behavior is intended, ensure the adapter type is set to Databricks or Spark in the relation/column context."],"exampleFix":"// before\nlet col_ddl = column.render_for_create();\n\n// after\nlet col_ddl = match adapter_type {\n    AdapterType::Databricks | AdapterType::Spark => column.render_for_create(),\n    _ => column.type_sql().to_string(),\n};","handlingStrategy":"validation","validationCode":"let supported = matches!(adapter_type, AdapterType::Databricks | AdapterType::Spark);\nif !supported { /* use default type rendering */ }","typeGuard":"fn supports_render_for_create(t: &AdapterType) -> bool { matches!(t, AdapterType::Databricks | AdapterType::Spark) }","tryCatchPattern":null,"preventionTips":["Branch on adapter type before rendering creation DDL with comments.","Use the platform's default column type rendering for non-Databricks/Spark targets.","Test DDL-generating macros per adapter before sharing them across projects."],"tags":["unimplemented","adapter-compat","databricks","spark","ddl"],"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-14T16:17:12.679Z"}