fix(sqlalchemy): update psycopg2 driver spec in connection urls - #910
Merged
Merged
Conversation
…equirements Signed-off-by: Cagri Yonca <cagri@ibm.com>
CagriYonca
force-pushed
the
fix-psycopg
branch
from
October 1, 2026 14:50
99425fc to
89286fb
Compare
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.
Summary
Explicitly specify
psycopg2as the SQLAlchemy dialect driver in PostgreSQLconnection URLs and bump the
psycopg2-binarylower bound to>=2.9.12.Problem
1. SQLAlchemy 2.1 changed the default PostgreSQL driver to psycopg (v3)
With an unqualified
postgresql://URL, SQLAlchemy 2.1 now attempts to loadpsycopg(v3) first. Since our test environment only installspsycopg2, this raises:See: SQLAlchemy 2.1 Migration Guide
2.
psycopg2-binary>=2.8.6has no pre-built wheel for Python 3.12/3.13On Python 3.12+, pip falls back to building from source, which fails due to
C-level incompatibilities introduced in those Python versions. Pre-built wheels
for Python 3.13 were introduced in
psycopg2-binary 2.9.10. The>=2.9.12lower bound guarantees a compatible wheel for all supported Python versions (3.9–3.14).
Changes
tests/clients/test_sqlalchemy.pypostgresql://→postgresql+psycopg2://tests/requirements.txtpsycopg2-binary>=2.8.6→>=2.9.12tests/requirements-pre315.txtpsycopg2-binary>=2.8.6→>=2.9.12