]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Ensure custom ops have consistent typing behavior, boolean support
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 1 Sep 2017 14:35:30 +0000 (10:35 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 1 Sep 2017 16:34:41 +0000 (12:34 -0400)
commit919b8bc4acf8de4720e8fff5077557f366fb3fb0
treefd515dc511a722b8a464c2c851cb59ddb4bda907
parent65680b2343ef421a62582e23e2b35293732933ad
Ensure custom ops have consistent typing behavior, boolean support

Refined the behavior of :meth:`.Operators.op` such that in all cases,
if the :paramref:`.Operators.op.is_comparison` flag is set to True,
the return type of the resulting expression will be
:class:`.Boolean`, and if the flag is False, the return type of the
resulting expression will be the same type as that of the left-hand
expression, which is the typical default behavior of other operators.
Also added a new parameter :paramref:`.Operators.op.return_type` as well
as a helper method :meth:`.Operators.bool_op`.

Change-Id: Ifc8553cd4037d741b84b70a9702cbd530f1a9de0
Fixes: #4063
doc/build/changelog/migration_12.rst
doc/build/changelog/unreleased_12/4063.rst [new file with mode: 0644]
doc/build/core/custom_types.rst
doc/build/core/tutorial.rst
lib/sqlalchemy/sql/default_comparator.py
lib/sqlalchemy/sql/operators.py
lib/sqlalchemy/sql/sqltypes.py
lib/sqlalchemy/sql/type_api.py
test/sql/test_operators.py