Skip to content

Commit

Permalink
Merge pull request #341 from igorvoltaic/add-empty-seed
Browse files Browse the repository at this point in the history
feat: allow adding an empty seed without rows
  • Loading branch information
BentsiLeviav authored Aug 18, 2024
2 parents 01fc55d + b4323aa commit 1ad813c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions dbt/include/clickhouse/macros/materializations/seed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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) %}
Expand Down

0 comments on commit 1ad813c

Please sign in to comment.