From 92a9c1b36d35b2c50dd3daecf864d752cf375682 Mon Sep 17 00:00:00 2001 From: barreiraricardo Date: Fri, 28 Jun 2024 15:56:56 +0200 Subject: [PATCH] Fix temporary table creation to support dbt unit tests --- dbt/include/clickhouse/macros/materializations/table.sql | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dbt/include/clickhouse/macros/materializations/table.sql b/dbt/include/clickhouse/macros/materializations/table.sql index 4b436212..b3cad47b 100644 --- a/dbt/include/clickhouse/macros/materializations/table.sql +++ b/dbt/include/clickhouse/macros/materializations/table.sql @@ -141,7 +141,7 @@ {% macro clickhouse__create_table_as(temporary, relation, sql) -%} {% set has_contract = config.get('contract').enforced %} {% set create_table = create_table_or_empty(temporary, relation, sql, has_contract) %} - {% if adapter.is_before_version('22.7.1.2484') -%} + {% if adapter.is_before_version('22.7.1.2484') or temporary -%} {{ create_table }} {%- else %} {% call statement('create_table_empty') %} @@ -159,8 +159,6 @@ {% if temporary -%} create temporary table {{ relation }} engine Memory - {{ order_cols(label="order by") }} - {{ partition_cols(label="partition by") }} {{ adapter.get_model_settings(model) }} as ( {{ sql }}