]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
use tuple expansion if type._is_tuple, test for Sequence if no type
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 5 Nov 2021 14:18:42 +0000 (10:18 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 5 Nov 2021 15:55:24 +0000 (11:55 -0400)
commit9ee47d90d804dc815685d42913ad170e04c38659
tree5d89c1ac21811b11d404b8a23c01bca545e10eda
parent7166159bffc30f3dbb3da8495cc5756c29b9a457
use tuple expansion if type._is_tuple, test for Sequence if no type

Fixed regression where the row objects returned for ORM queries, which are
now the normal :class:`_sql.Row` objects, would not be interpreted by the
:meth:`_sql.ColumnOperators.in_` operator as tuple values to be broken out
into individual bound parameters, and would instead pass them as single
values to the driver leading to failures. The change to the "expanding IN"
system now accommodates for the expression already being of type
:class:`.TupleType` and treats values accordingly if so. In the uncommon
case of using "tuple-in" with an untyped statement such as a textual
statement with no typing information, a tuple value is detected for values
that implement ``collections.abc.Sequence``, but that are not ``str`` or
``bytes``, as always when testing for ``Sequence``.

Added :class:`.TupleType` to the top level ``sqlalchemy`` import namespace.

Fixes: #7292
Change-Id: I8286387e3b3c3752b3bd4ae3560d4f31172acc22
(cherry picked from commit 0c44a1e77cfde0f841a4a64140314c6b833efdab)
doc/build/changelog/unreleased_14/7292.rst [new file with mode: 0644]
lib/sqlalchemy/__init__.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/sqltypes.py
lib/sqlalchemy/testing/suite/test_select.py
lib/sqlalchemy/types.py
lib/sqlalchemy/util/__init__.py
test/sql/test_lambdas.py
test/sql/test_resultset.py