summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-10-21 15:01:03 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-10-21 15:22:52 -0400
commit91e14cc42c3c715f57db7d910761dfd5dd55e2b1 (patch)
tree397eaa7484e892561663b600be38fd18122d3972 /lib/sqlalchemy
parente3dc20ff27fa75e571fb2631e64737ea8f25f7c5 (diff)
downloadsqlalchemy-91e14cc42c3c715f57db7d910761dfd5dd55e2b1.tar.gz
Don't load expired objects from evaluator
part 2 of e3dc20ff27fa75e571fb2631e64737ea8f25f7c5, the pre-evaluate step was also emitting SELECT for expired objects. Fixes: #5664 Change-Id: I9f5de2a5d480eafeb290ec0c45ce2a82ec93475b
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/persistence.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/persistence.py b/lib/sqlalchemy/orm/persistence.py
index 1794cc2ce..cfb6d9265 100644
--- a/lib/sqlalchemy/orm/persistence.py
+++ b/lib/sqlalchemy/orm/persistence.py
@@ -1978,6 +1978,7 @@ class BulkUDCompileState(CompileState):
state.obj()
for state in session.identity_map.all_states()
if state.mapper.isa(mapper)
+ and not state.expired
and eval_condition(state.obj())
and (
update_options._refresh_identity_token is None
@@ -2209,9 +2210,8 @@ class BulkORMUpdate(UpdateDMLState, BulkUDCompileState):
# only evaluate unmodified attributes
to_evaluate = state.unmodified.intersection(evaluated_keys)
for key in to_evaluate:
- if key not in dict_:
- continue
- dict_[key] = update_options._value_evaluators[key](obj)
+ if key in dict_:
+ dict_[key] = update_options._value_evaluators[key](obj)
state.manager.dispatch.refresh(state, None, to_evaluate)