-
Notifications
You must be signed in to change notification settings - Fork 89
Do not duplicate BEGIN statement #944
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
Open
rjspotter
wants to merge
8
commits into
dbt-labs:main
Choose a base branch
from
rjspotter:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+9
−0
Conversation
This file contains hidden or 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
Thank you for your pull request! We could not find a changelog entry for this change in the dbt-postgres package. For details on how to document a change, see the Contributing Guide. |
Because: - dbt-labs/dbt-core#9434 - Psychopg2 starts a transaction automatically but does not necessarily end it without intervention "By default, Psycopg opens a transaction before executing the first command:" https://www.psycopg.org/docs/connection.html - Postgres allows the behaviour of two begin statements with only a warning. Other systems that use the Postgres protocols and syntax are not necessarily so forgiving. This commit: - Bypasses the dbt generated BEGIN statement in dbt-postgres
How long does it normally take for a reviewer to be assigned? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because:
BEGIN
when listing schemas dbt-core#9434This commit:
resolves #
dbt-labs/dbt-core#9434
Problem
Two begin statements are issued one by the default behaviour of psycopg2, the other by dbt via
begin()
callingadd_begin_query()
[BEFORE] by modifying
sql/connections.py
you can see the BEGIN from psycopg2 and the modified BEGIN from dbtSolution
Make
add_begin_query
a passthrough for dbt-postgres[AFTER] you get exactly one BEGIN and one COMMIT per query/session
Notice that
add_commit_query
retains the existing behaviour.Checklist