refactor: set cascade_backrefs=False for SavedQuery#42212
Conversation
Enable the pytest error filter for the "'SavedQuery' object is being merged into a Session along the backref cascade path" RemovedIn20Warning and adopt the SQLAlchemy 2.0 behavior for both SavedQuery backrefs (User.saved_queries and Database.saved_queries). Constructing SavedQuery(database=...) or SavedQuery(user=...) no longer implicitly merges the new object into the parent's session. All persisting code paths already add saved queries explicitly. See discussion #40273. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Code Review Agent Run #e52282Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #42212 +/- ##
==========================================
- Coverage 65.19% 65.19% -0.01%
==========================================
Files 2768 2768
Lines 156081 156081
Branches 35719 35719
==========================================
- Hits 101754 101751 -3
- Misses 52365 52367 +2
- Partials 1962 1963 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
See #40273
SUMMARY
Enable errors for the
"SavedQuery" object is being merged into a Session along the backref cascade pathRemovedIn20Warning, and adopt the SQLAlchemy 2.0 behavior for both SavedQuery backrefs (User.saved_queriesandDatabase.saved_queries).Constructing
SavedQuery(database=...)orSavedQuery(user=...)no longer implicitly merges the new object into the parent's session. All code paths that persist saved queries already callsession.add()explicitly, so no call sites needed changes.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
🤖 Generated with Claude Code