Update docs for transaction handling - snowflake.md#2480
Update docs for transaction handling - snowflake.md#2480sspaeti wants to merge 1 commit intodlt-hub:develfrom
Conversation
✅ Deploy Preview for dlt-hub-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
Just FYI: I'm not sure if the |
|
@sspaeti how did you manage to change session settings? each loader job gets a separate connection which is closed after COPY/MERGE command. I'm asking because indeed we didn't start the transaction before SQL job and I changed that: we do it in |
|
@rudolfix It was set at a account level (globally). As it can be set on three levels:
Whereas session user and account settings overrule. See https://docs.snowflake.com/en/sql-reference/parameters#label-autocommit. I believe this happens, because you only explicitly set the |
|
@sspaeti now I get it? should we just set autocommit explicitly to TRUE on opening the connection? we do that anyway after comitting/rollbacking the transaction. |
|
this PR will explicitly set autocommit on new connection #2593 |
Description
If you use Snowflake and have transaction settings not set to default, e.g., have set
ALTER SESSION SET AUTOCOMMIT = FALSE;, dlt will not work properly and end up having an open session with uncommitted Inserts/merge statements.I added a note to the docs with this PR to make that clear and not run into errors I did.
Additional Context
Even better would be to explicitly set
ALTER SESSION SET AUTOCOMMIT = TRUE;on the insert to destination schema as well as you do for inserting into Staging, where you addedALTER SESSION SET AUTOCOMMIT = TRUE;explicitly.PS: I added the note to
Additional connection options, not sure if that is the best place. Feel free to reorder or let me know where it would make more sense.