-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Snowflake: no transactions, except for DML (#3510)
* Rm Snowflake txnal logic. Explicit for DML * Be less clever. Update create_or_replace_view() * Seed DML as well * Changelog entry * Fix unit test * One semicolon can change the world
- Loading branch information
Showing
12 changed files
with
126 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ | |
( | ||
select {{ dest_cols_csv }} | ||
from {{ source }} | ||
); | ||
) | ||
|
||
{%- endmacro %} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
plugins/snowflake/dbt/include/snowflake/macros/materializations/seed.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{% macro snowflake__load_csv_rows(model, agate_table) %} | ||
{% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %} | ||
{% set bindings = [] %} | ||
|
||
{% set statements = [] %} | ||
|
||
{% for chunk in agate_table.rows | batch(batch_size) %} | ||
{% set bindings = [] %} | ||
|
||
{% for row in chunk %} | ||
{% do bindings.extend(row) %} | ||
{% endfor %} | ||
|
||
{% set sql %} | ||
insert into {{ this.render() }} ({{ cols_sql }}) values | ||
{% for row in chunk -%} | ||
({%- for column in agate_table.column_names -%} | ||
%s | ||
{%- if not loop.last%},{%- endif %} | ||
{%- endfor -%}) | ||
{%- if not loop.last%},{%- endif %} | ||
{%- endfor %} | ||
{% endset %} | ||
|
||
{% do adapter.add_query('BEGIN', auto_begin=False) %} | ||
{% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %} | ||
{% do adapter.add_query('COMMIT', auto_begin=False) %} | ||
|
||
{% if loop.index0 == 0 %} | ||
{% do statements.append(sql) %} | ||
{% endif %} | ||
{% endfor %} | ||
|
||
{# Return SQL so we can render it out into the compiled files #} | ||
{{ return(statements[0]) }} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters