From 8db9d8feef8cfdbd8fbb284da6ec966c845f81eb Mon Sep 17 00:00:00 2001 From: cookieark Date: Tue, 1 Sep 2026 07:55:39 +0530 Subject: [PATCH] fix(clickhouse): register table comments via command instead of inline CTAS ClickhouseEngineAdapter set COMMENT_CREATION_VIEW to COMMENT_COMMAND_ONLY but never set COMMENT_CREATION_TABLE, so it silently inherited the EngineAdapter default of IN_SCHEMA_DEF_CTAS. That default asserts the engine can embed COMMENT '...' inside a CREATE TABLE ... AS SELECT, which ClickHouse Cloud rejects with a syntax error (code 62, SYNTAX_ERROR). Setting COMMENT_CREATION_TABLE to COMMENT_COMMAND_ONLY keeps the comment out of the CTAS entirely and routes both the table description and the column descriptions through the post-create ALTER TABLE ... MODIFY COMMENT and ALTER TABLE ... COMMENT COLUMN paths, which the adapter already implements and which views already rely on. Fixes #5969 Signed-off-by: cookieark --- sqlmesh/core/engine_adapter/clickhouse.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqlmesh/core/engine_adapter/clickhouse.py b/sqlmesh/core/engine_adapter/clickhouse.py index d1f67e0564..92e3c33e6f 100644 --- a/sqlmesh/core/engine_adapter/clickhouse.py +++ b/sqlmesh/core/engine_adapter/clickhouse.py @@ -13,6 +13,7 @@ DataObjectType, EngineRunMode, SourceQuery, + CommentCreationTable, CommentCreationView, InsertOverwriteStrategy, ) @@ -36,6 +37,7 @@ class ClickhouseEngineAdapter(EngineAdapterWithIndexSupport, LogicalMergeMixin): SUPPORTS_TRANSACTIONS = False SUPPORTS_VIEW_SCHEMA = False SUPPORTS_REPLACE_TABLE = False + COMMENT_CREATION_TABLE = CommentCreationTable.COMMENT_COMMAND_ONLY COMMENT_CREATION_VIEW = CommentCreationView.COMMENT_COMMAND_ONLY SCHEMA_DIFFER_KWARGS = {}