-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADAP-620] [Bug] Incremental materialization with "append" strategy does not wrap dml with explicit transaction #656
Comments
@danielefrigo great catch! would you be interested in opening the corresponding pull request? I'd be glad to help you get it over the finish line. |
…oes not wrap dml with explicit transaction Fixes dbt-labs#656
I prepared a PR for this (I'm not an expert so please be patient and give me some suggestion). But before going on, this digging into the code makes me think about Snowflake transactions management: Isn't |
…oes not wrap dml with explicit transaction Fixes dbt-labs#656
…oes not wrap dml with explicit transaction Fixes dbt-labs#656
hey @danielefrigo, just took the time to reproduce your result. Correct me if I'm wrong but the insert logic you hope to have wrapped in a transaction is I agree that this macro could be executed as a transaction, but I'm not sure what it would accomplish, because it is just a single SQL statement. I may be missing something, but I thought that transactions are helpful when executing a series of a related SQL statements. Instead the update logic of an append is just the following. right? insert into TEST_DB.dbt_ajs.daniele ("ID", "FIRST_NAME", "LAST_NAME")
(
select "ID", "FIRST_NAME", "LAST_NAME"
from TEST_DB.dbt_ajs.daniele__dbt_tmp
) |
Let's start saying that I was overriding the |
…oes not wrap dml with explicit transaction (dbt-labs#673) * [ADAP-620] [Bug] Incremental materialization with "append" strategy does not wrap dml with explicit transaction Fixes dbt-labs#656 * changie --------- Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com>
Is this a new bug in dbt-snowflake?
Current Behavior
When running an incremental model with "append" incremental strategy, the INSERT statement is not wrapped with an explicit transaction.
Expected Behavior
The INSERT statement should be wrapped as all other DML statements, leveraging the
snowflake_dml_explicit_transaction
macro.Steps To Reproduce
begin; commit; end;
Relevant log output
No response
Environment
Additional Context
Should be easily fixed adding this here:
{% macro snowflake__get_incremental_append_sql(get_incremental_append_sql) %} {% set dml = default__get_incremental_append_sql(get_incremental_append_sql) %} {% do return(snowflake_dml_explicit_transaction(dml)) %} {% endmacro %}
The text was updated successfully, but these errors were encountered: