Amazon Redshift adapter behavior changes
The following are the current behavior change flags that are specific to dbt-redshift:
The redshift_skip_autocommit_transaction_statements flag
Available starting dbt-redshift 1.12.0.
The redshift_skip_autocommit_transaction_statements flag controls whether dbt sends explicit BEGIN, COMMIT, and ROLLBACK statements to Amazon Redshift when autocommit is enabled. Since dbt-redshift 1.5, the default Redshift connection uses autocommit=True, so the driver already commits each statement. In that setup, the statements are redundant when autocommit is enabled and add extra round trips to Redshift.
-
When set to
False(default), dbt sendsBEGIN,COMMIT, andROLLBACKstatements (legacy behavior). -
When set to
True, dbt does not sendBEGIN,COMMIT, orROLLBACKstatements to Redshift, which can reduce round trips and improve performance. dbt still callsbegin(),commit(), androllback_if_open()on the connection, but no longer issues the matching SQL:begin()is invoked, but dbt does not executeBEGINon Redshift.commit()is invoked, but dbt does not executeCOMMITon Redshift.rollback_if_open()is invoked, but dbt does not executeROLLBACKon Redshift.
dbt still maintains its internal transaction_open state so transaction tracking remains consistent even when those SQL statements are skipped.
To skip unnecessary transaction statements when autocommit is enabled, set the flag to True in your dbt_project.yml:
flags:
redshift_skip_autocommit_transaction_statements: true
How this flag interacts with autocommit
- If the connection uses
autocommit=False, dbt’s explicit transaction behavior is unchanged. - If the connection uses
autocommit=True(default) and the flag isFalse(default), dbt still sendsBEGIN,COMMIT, andROLLBACK. - If the connection uses
autocommit=Trueand the flag isTrue, dbt skips those statements.
Was this page helpful?
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.