diff --git a/dbt/include/clickhouse/macros/materializations/seed.sql b/dbt/include/clickhouse/macros/materializations/seed.sql index f05a5ac4..4f105d72 100644 --- a/dbt/include/clickhouse/macros/materializations/seed.sql +++ b/dbt/include/clickhouse/macros/materializations/seed.sql @@ -2,14 +2,16 @@ {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %} {% set data_sql = adapter.get_csv_data(agate_table) %} - {% set sql -%} - insert into {{ this.render() }} ({{ cols_sql }}) - {{ adapter.get_model_query_settings(model) }} - format CSV - {{ data_sql }} - {%- endset %} + {% if data_sql %} + {% set sql -%} + insert into {{ this.render() }} ({{ cols_sql }}) + {{ adapter.get_model_query_settings(model) }} + format CSV + {{ data_sql }} + {%- endset %} - {% do adapter.add_query(sql, bindings=agate_table, abridge_sql_log=True) %} + {% do adapter.add_query(sql, bindings=agate_table, abridge_sql_log=True) %} + {% endif %} {% endmacro %} {% macro clickhouse__create_csv_table(model, agate_table) %}