diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-07-16 12:41:09 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-07-19 13:08:06 -0400 |
commit | 88168db8e9a51ce438e06bfe792e758ed9297ab8 (patch) | |
tree | e9ce458fdcc4f43c288e1c823476af21bb350d9a /lib/sqlalchemy/sql/coercions.py | |
parent | c01f90de584f50f036c5b6d0c44074b4b3014da4 (diff) | |
download | sqlalchemy-88168db8e9a51ce438e06bfe792e758ed9297ab8.tar.gz |
Support tuple IN VALUES for SQLite, others
Added support for composite (tuple) IN operators with SQLite, by rendering
the VALUES keyword for this backend. As other backends such as DB2 are
known to use the same syntax, the syntax is enabled in the base compiler
using a dialect-level flag ``tuple_in_values``. The change also includes
support for "empty IN tuple" expressions for SQLite when using "in_()"
between a tuple value and an empty set.
Fixes: #4766
Change-Id: I416e1af29b31d78f9ae06ec3c3a48ef6d6e813f5
Diffstat (limited to 'lib/sqlalchemy/sql/coercions.py')
-rw-r--r-- | lib/sqlalchemy/sql/coercions.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/coercions.py b/lib/sqlalchemy/sql/coercions.py index 64d9f0f96..8a9f0b979 100644 --- a/lib/sqlalchemy/sql/coercions.py +++ b/lib/sqlalchemy/sql/coercions.py @@ -332,7 +332,9 @@ class InElementImpl(RoleImpl, roles.InElementRole): o = expr._bind_param(operator, o) args.append(o) - return elements.ClauseList(*args) + return elements.ClauseList( + _tuple_values=isinstance(expr, elements.Tuple), *args + ) else: self._raise_for_expected(element, **kw) @@ -354,7 +356,6 @@ class InElementImpl(RoleImpl, roles.InElementRole): return element.self_group(against=operator) elif isinstance(element, elements.BindParameter) and element.expanding: - if isinstance(expr, elements.Tuple): element = element._with_expanding_in_types( [elem.type for elem in expr] |