summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-07-16 12:41:09 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-07-19 13:08:06 -0400
commit88168db8e9a51ce438e06bfe792e758ed9297ab8 (patch)
treee9ce458fdcc4f43c288e1c823476af21bb350d9a /lib/sqlalchemy/sql/compiler.py
parentc01f90de584f50f036c5b6d0c44074b4b3014da4 (diff)
downloadsqlalchemy-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/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index ea7e890e7..740abeb3d 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -966,13 +966,17 @@ class SQLCompiler(Compiled):
sep = " "
else:
sep = OPERATORS[clauselist.operator]
- return sep.join(
+
+ text = sep.join(
s
for s in (
c._compiler_dispatch(self, **kw) for c in clauselist.clauses
)
if s
)
+ if clauselist._tuple_values and self.dialect.tuple_in_values:
+ text = "VALUES " + text
+ return text
def visit_case(self, clause, **kwargs):
x = "CASE "