Skip to content

test: accept sqlalchemy 2.1 wrapping the factory's TargetServerAttributeNotMatched - #56

Merged
lesnik512 merged 1 commit into
mainfrom
test/sqlalchemy-2.1-wrapped-connect-error
Sep 25, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
test/sqlalchemy-2.1-wrapped-connect-error

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Fixes the red pytest legs of the scheduled dependency check (run 36129136224).

SQLAlchemy 2.1.0 now translates asyncpg exceptions raised by an async_creator into DBAPI errors. The multi-host factory's final asyncpg.TargetServerAttributeNotMatched therefore reaches the caller as sqlalchemy.exc.InternalError, with the asyncpg error as orig.__cause__. On 2.0 it arrives raw. The test now accepts either shape and asserts the asyncpg error is the root. TimeoutError and OSError are not translated, so the other connection-factory tests pass unchanged.

Verified: the full suite passes against Postgres at 100% coverage on sqlalchemy 2.0.54 and 2.1.0; just lint-ci green, and ty is also clean on 2.0.54.

Not in this PR: the same translation changes what is_retriable sees for connect-time errors. That is tracked separately.

@lesnik512
lesnik512 merged commit a6a9001 into main Sep 25, 2026
12 checks passed
@lesnik512
lesnik512 deleted the test/sqlalchemy-2.1-wrapped-connect-error branch September 25, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant