Skip to content

fix(sqlalchemy): preserve logic exceptions in atomic blocks - #572

Merged
HosseinNejatiJavaremi merged 1 commit into
masterfrom
fix/sqlalchemy-atomic-preserve-errors
Nov 2, 2026
Merged

HosseinNejatiJavaremi merged 1 commit into
masterfrom
fix/sqlalchemy-atomic-preserve-errors

Conversation

@HosseinNejatiJavaremi

Copy link
Copy Markdown
Member

The atomic decorator now maps only SQLAlchemyError to Database*Error and re-raises logic exceptions unchanged. A default nested failure stores the first exception and re-raises it at the outer boundary; DatabaseTransactionError is reserved for transaction failures. A failed rollback is logged without hiding the original error; savepoint isolation is unchanged.
Tests: sqlite 102/102, postgres 90/90, mysql 58/58, multiple databases 24/24; ruff, ty and docs-check clean.
Includes the 5.28.0 changelog.

Closes #571

The atomic decorator maps only SQLAlchemy failures to Database*Error and re-raises every other exception unchanged. A default nested failure stores the first exception and re-raises it at the outer boundary instead of DatabaseTransactionError; a failed rollback is logged without hiding it. Savepoints keep their isolation behavior. Updates tests, docs and the 5.28.0 changelog.
@HosseinNejatiJavaremi HosseinNejatiJavaremi added bug Something isn't working area:mysql mysql adapter package area:postgres postgres adapter package area:sqlite sqlite adapter package area:starrocks starrocks adapter package priority:high Needs attention soon labels Nov 2, 2026
@HosseinNejatiJavaremi HosseinNejatiJavaremi self-assigned this Nov 2, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation area:testing BDD tests and test containers labels Nov 2, 2026
@HosseinNejatiJavaremi
HosseinNejatiJavaremi merged commit 4cb8d15 into master Nov 2, 2026
30 checks passed
@HosseinNejatiJavaremi
HosseinNejatiJavaremi deleted the fix/sqlalchemy-atomic-preserve-errors branch November 2, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:mysql mysql adapter package area:postgres postgres adapter package area:sqlite sqlite adapter package area:starrocks starrocks adapter package area:testing BDD tests and test containers bug Something isn't working documentation Improvements or additions to documentation priority:high Needs attention soon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(sqlalchemy): atomic decorator must preserve logic exceptions

1 participant