bump version to 0.7.1.post3 and enhance backward compatibility for as…#36
Merged
bump version to 0.7.1.post3 and enhance backward compatibility for as…#36
Conversation
…yncio.gather() without multi_sessions flag
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #36 +/- ##
==========================================
+ Coverage 96.71% 98.13% +1.42%
==========================================
Files 3 3
Lines 152 107 -45
==========================================
- Hits 147 105 -42
+ Misses 5 2 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
added 2 commits
December 23, 2025 16:35
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.
This pull request restores and improves backward compatibility for
asyncio.gather()usage withdb.session.execute()in FastAPI applications usingfastapi-async-sqlalchemy, and clarifies behavioral changes regarding session management in multi-session mode. It also adds comprehensive tests to cover both the backward compatibility fix and the new session caching behavior, including documentation for a breaking change introduced in a previous commit.Backward Compatibility and Bug Fixes:
middleware.pyhas been updated to gracefully handle cases whereasyncio.current_task()raises aRuntimeError(e.g., in synchronous contexts), falling back to a single session mode instead of raising an error. This restores support for old usage patterns whereasyncio.gather()is called without explicitly enablingmulti_sessions. [1] [2]middleware.pyis improved for robustness, ensuring cleanup tasks and session closing are handled correctly in both multi-session and single-session modes. [1] [2]Testing and Documentation:
test_backward_compat_gather.py, is added to verify that common patterns usingasyncio.gather()withdb.session.execute()work as expected without requiringmulti_sessions=True, ensuring backward compatibility for existing production code.test_coverage_improvements.py, verifying that the fallback to sync context works whencurrent_task()returnsNone. [1] [2]test_regression_concurrent.py, is added to document and demonstrate the breaking change in session management introduced in commit4e99374. This includes migration guidance and tests that illustrate the new requirement for wrapping parallel queries in separate async functions when usingmulti_sessions=True.Versioning:
0.7.1.post3to reflect these changes and fixes.References:
[1] [2] [3] [4] [5] [6] [7] [8] [9]…yncio.gather() without multi_sessions flag