Skip to main content

Amazon Redshift adapter behavior changes

The following are the current behavior change flags that are specific to dbt-redshift:

Flagdbt-redshift: Introdbt-redshift: MaturityStatus
redshift_skip_autocommit_transaction_statements1.12.0TBDActive

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 sends BEGIN, COMMIT, and ROLLBACK statements (legacy behavior).

  • When set to True, dbt does not send BEGIN, COMMIT, or ROLLBACK statements to Redshift, which can reduce round trips and improve performance. dbt still calls begin(), commit(), and rollback_if_open() on the connection, but no longer issues the matching SQL:

    • begin() is invoked, but dbt does not execute BEGIN on Redshift.
    • commit() is invoked, but dbt does not execute COMMIT on Redshift.
    • rollback_if_open() is invoked, but dbt does not execute ROLLBACK on 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:

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 is False (default), dbt still sends BEGIN, COMMIT, and ROLLBACK.
  • If the connection uses autocommit=True and the flag is True, dbt skips those statements.

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

0
Loading