Upgrade to psycopg3 - #1903
Draft
bmos wants to merge 18 commits into
Draft
Upgrade to psycopg3#1903bmos wants to merge 18 commits into
bmos wants to merge 18 commits into
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Collaborator
|
Psycopg2 was historically the single biggest source of installation issues for Parsons, so I am wary of touching it, especially with known breaking changes, before November. But we can queue this to merge afterwards (once it's ready of course). |
Collaborator
Author
|
Absolutely. That's why I have kept this a draft for now. I think we need pretty comprehensive testing from people who are already using these features. Especially because the supported queries appear to have changed pretty dramatically in version 3. |
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 9.0.0 to 10.0.1. - [Release notes](https://github.com/astral-sh/setup-uv/releases) - [Commits](astral-sh/setup-uv@c771a70...20cfd1b) --- updated-dependencies: - dependency-name: astral-sh/setup-uv dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
This branch has not been deployed
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
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.
This PR picks up from #987
What is this change?
client_encodingarg to redshift connectionConsiderations for discussion
How to test the changes (if needed)
I have not run the live tests. Postgres, Redshift, and Alchemy are the parts that are most in need of validation.
Breaking Changes
Breaking changes are changes to our public API which may require existing users to change their code. If there are no breaking changes, any existing parsons user should not need to do anything after updating their parsons version.
Does this PR introduce breaking changes?
Details (if needed)
Breaking changes to parameterization
A few parameterization patterns that worked with psycopg2 no longer work with psycopg3.
They are detailed on the migration guide, but these in particular should be highlighted:
You can no longer use
IN %swith a tupleThis would work with psycopg2 but will not work with psycopg3:
conn.execute("SELECT * FROM foo WHERE id IN %s", parameters=[(10,20,30)])Instead, this format is advised:
conn.execute("SELECT * FROM foo WHERE id = ANY(%s)", parameters=[[10,20,30]])You can no longer use
IS %sThis would work with psycopg2 but will not work with psycopg3:
conn.execute("SELECT * FROM foo WHERE field IS %s", [None])Instead,
IS NOT DISTINCT FROM %sshould be usedconn.execute("SELECT * FROM foo WHERE field IS NOT DISTINCT FROM %s", [None])Copy methods are refactored and consolidated in psycopg3, including breaking changes.
See the migration guide for details.