diff --git a/apps/framework-cli/src/infrastructure/olap/clickhouse/queries.rs b/apps/framework-cli/src/infrastructure/olap/clickhouse/queries.rs index 070fc1d50..30578be4c 100644 --- a/apps/framework-cli/src/infrastructure/olap/clickhouse/queries.rs +++ b/apps/framework-cli/src/infrastructure/olap/clickhouse/queries.rs @@ -114,7 +114,7 @@ CREATE TABLE IF NOT EXISTS `{{db_name}}`.`{{table_name}}` {{/each}} ) ENGINE = {{engine}} -{{#if primary_key_string}}PRIMARY KEY (`{{primary_key_string}}`) {{/if}} +{{#if primary_key_string}}PRIMARY KEY ({{primary_key_string}}) {{/if}} {{#if order_by_string}}ORDER BY ({{order_by_string}}) {{/if}} "#; @@ -150,7 +150,7 @@ pub fn create_table_query( "table_name": table.name, "fields": builds_field_context(&table.columns)?, "primary_key_string": if !primary_key.is_empty() { - Some(primary_key.join(", ")) + Some(format!("`{}`", primary_key.join("`, `"))) } else { None },