]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
implement python_impl to custom_op for basic ORM evaluator extensibility
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 4 Jan 2022 19:04:15 +0000 (14:04 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 4 Jan 2022 21:40:35 +0000 (16:40 -0500)
commit63eeec396e5d180e11a342920e7c3e49be434eb1
tree02e203f26828018189ef20d0ff73fcc70f61c386
parent400bf1716f84821d63daaf0a988d725dfd55d6a0
implement python_impl to custom_op for basic ORM evaluator extensibility

Added new parameter :paramref:`_sql.Operators.op.python_impl`, available
from :meth:`_sql.Operators.op` and also when using the
:class:`_sql.Operators.custom_op` constructor directly, which allows an
in-Python evaluation function to be provided along with the custom SQL
operator. This evaluation function becomes the implementation used when the
operator object is used given plain Python objects as operands on both
sides, and in particular is compatible with the
``synchronize_session='evaluate'`` option used with
:ref:`orm_expression_update_delete`.

Fixes: #3162
Change-Id: If46ba6a0e303e2180a177ba418a8cafe9b42608e
doc/build/changelog/unreleased_20/3162.rst [new file with mode: 0644]
doc/build/orm/session_basics.rst
lib/sqlalchemy/orm/evaluator.py
lib/sqlalchemy/sql/operators.py
test/ext/test_hybrid.py
test/orm/test_evaluator.py
test/sql/test_operators.py