Skip to content

feat: add manual database session handling with rollback on exception#770

Merged
seapagan merged 2 commits into
mainfrom
manual-database-session
Aug 10, 2025
Merged

feat: add manual database session handling with rollback on exception#770
seapagan merged 2 commits into
mainfrom
manual-database-session

Conversation

@seapagan
Copy link
Copy Markdown
Owner

@seapagan seapagan commented Aug 10, 2025

Add a second database dependency that will NOT call the explicit .begin() on the session, so the session will only be opened when first accessed and should allow multiple database calls in the same route.

Should allow closing #768

In future this may be the default functionality but for now lets leave the auto-commit dependency as default.

Signed-off-by: Grant Ramsay <seapagan@gmail.com>
@seapagan seapagan self-assigned this Aug 10, 2025
@seapagan seapagan added the enhancement New feature or request label Aug 10, 2025
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Aug 10, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%) 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (77f5cd9) 1537 1537 100.00%
Head commit (2287c66) 1544 (+7) 1544 (+7) 100.00% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#770) 7 7 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Signed-off-by: Grant Ramsay <seapagan@gmail.com>
@seapagan seapagan marked this pull request as ready for review August 10, 2025 16:20
@seapagan seapagan merged commit c1c8c1a into main Aug 10, 2025
16 checks passed
@seapagan seapagan deleted the manual-database-session branch August 10, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can commit only once with session per route (otherwise sqlalchemy.exc.InvalidRequestError)

1 participant