Skip to content

Commit 8db9d8f

Browse files
author
cookieark
committed
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 <aishwary.kantode@gmail.com>
1 parent 4c54937 commit 8db9d8f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

sqlmesh/core/engine_adapter/clickhouse.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
DataObjectType,
1414
EngineRunMode,
1515
SourceQuery,
16+
CommentCreationTable,
1617
CommentCreationView,
1718
InsertOverwriteStrategy,
1819
)
@@ -36,6 +37,7 @@ class ClickhouseEngineAdapter(EngineAdapterWithIndexSupport, LogicalMergeMixin):
3637
SUPPORTS_TRANSACTIONS = False
3738
SUPPORTS_VIEW_SCHEMA = False
3839
SUPPORTS_REPLACE_TABLE = False
40+
COMMENT_CREATION_TABLE = CommentCreationTable.COMMENT_COMMAND_ONLY
3941
COMMENT_CREATION_VIEW = CommentCreationView.COMMENT_COMMAND_ONLY
4042

4143
SCHEMA_DIFFER_KWARGS = {}

0 commit comments

Comments
 (0)