Skip to content

chore: upgrade db-retry to 0.8.1 and SQLAlchemy to 2.0.55 - #71

Merged
lesnik512 merged 2 commits into
mainfrom
chore/db-retry-0.8.1
Oct 17, 2026
Merged

lesnik512 merged 2 commits into
mainfrom
chore/db-retry-0.8.1

Conversation

@lesnik512

@lesnik512 lesnik512 commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Raises the db-retry floor from 0.8.0 to 0.8.1 and upgrades SQLAlchemy from 2.0.54 to 2.0.55 in the lock. The sqlalchemy[asyncio]<2.1 pin stays.

In db-retry 0.8.1, Transaction.__aenter__ rolls back the session's transaction on entry when that transaction can no longer continue: SQLAlchemy marked it inactive after a failed flush, or a connection it already holds was invalidated (modern-python/db-retry#75). With 0.8.0, a connection lost on a query or flush after the block made the retried attempt fail with PendingRollbackError. With 0.8.1 the retry starts on a fresh connection and recovers. A live transaction is still joined, so uncommitted work is kept.

The rule that every query goes inside the Transaction block still applies. A query that runs before the block fails the retried attempt before __aenter__ gets a chance to roll back.

Release notes: https://github.com/modern-python/db-retry/releases/tag/0.8.1

SQLAlchemy 2.0.55 (released 2026-10-16) fixes ticket 13673. If a task was cancelled a second time while the pool was closing an asyncio connection invalidated by the first cancellation, the closed connection stayed in the pool, and the next checkout got it and failed on first use. With pool_pre_ping off, only postgres_retry would have caught that. The release also fixes related cancellation handling in the pool (tickets 12710, 13622 and 13678).

Checked locally: just lint, just test and just test-migrations in Docker, with SQLAlchemy 2.0.55 and db-retry 0.8.1 installed in the container.

@lesnik512 lesnik512 changed the title chore: upgrade db-retry to 0.8.1 chore: upgrade db-retry to 0.8.1 and SQLAlchemy to 2.0.55 Oct 17, 2026
@lesnik512
lesnik512 merged commit 663fd4a into main Oct 17, 2026
3 checks passed
@lesnik512
lesnik512 deleted the chore/db-retry-0.8.1 branch October 17, 2026 08:31
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