]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Add type awareness to evaluator
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 13 Sep 2022 15:00:46 +0000 (11:00 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 13 Sep 2022 15:18:19 +0000 (11:18 -0400)
commit14b634d7065446d146456eed006c4969a7972b1a
treeaa94ea605196a585de4b43f195df9db143133a0f
parent479dbc99e7fc5a60f846992c0cca8542047a8933
Add type awareness to evaluator

Fixed regression where using ORM update() with synchronize_session='fetch'
would fail due to the use of evaluators that are now used to determine the
in-Python value for expressions in the the SET clause when refreshing
objects; if the evaluators make use of math operators against non-numeric
values such as PostgreSQL JSONB, the non-evaluable condition would fail to
be detected correctly. The evaluator now limits the use of math mutation
operators to numeric types only, with the exception of "+" that continues
to work for strings as well. SQLAlchemy 2.0 may alter this further by
fetching the SET values completely rather than using evaluation.

Fixes: #8507
Change-Id: Icf7120ccbf4266499df6bb3e05159c9f50971d69
doc/build/changelog/unreleased_14/8507.rst [new file with mode: 0644]
lib/sqlalchemy/orm/evaluator.py
test/orm/test_evaluator.py