]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
dont produce side effects for do_orm_execute
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 24 May 2026 14:05:29 +0000 (10:05 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 24 May 2026 14:05:29 +0000 (10:05 -0400)
commit34f92ab90c5af9dd08727883df89632a083c76a0
tree3b8a22f698947be8b77165681d2904c6a8bdecb5
parent483c27e0cc9f4855a0c9482e7a300d4a07287aec
dont produce side effects for do_orm_execute

Fixed issue where the presence of a do_orm_execute event hook would cause
internal execution options such as yield_per and loader-specific state from
the first orm_pre_session_exec pass to leak into the second pass, leading to
errors when using relationship loaders such as selectinload and immediateload.
The execution options passed to the second compilation pass are now based on
the original options plus only the explicit updates made via
ORMExecuteState.update_execution_options() within the event hook.

Fixes: #13301
Change-Id: Ide64d7202102930b68a2ab903054d538cd2f99dd
doc/build/changelog/unreleased_20/13301.rst [new file with mode: 0644]
lib/sqlalchemy/orm/session.py
test/orm/test_events.py