From b17fa2513e412b8f9aa1f62c0acc7fa3805e632b Mon Sep 17 00:00:00 2001 From: Nicolas Rolin Date: Fri, 25 May 2018 13:27:22 -0400 Subject: Add support of empty list in exanding of bindparam Added new logic to the "expanding IN" bound parameter feature whereby if the given list is empty, a special "empty set" expression that is specific to different backends is generated, thus allowing IN expressions to be fully dynamic including empty IN expressions. Fixes: #4271 Change-Id: Icc3c73bbd6005206b9d06baaeb14a097af5edd36 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/432 --- lib/sqlalchemy/sql/compiler.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/sqlalchemy/sql/compiler.py') diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 529e28ba6..57da43217 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -1058,6 +1058,12 @@ class SQLCompiler(Compiled): self._emit_empty_in_warning() return self.process(binary.left == binary.left) + def visit_empty_set_expr(self, type_): + raise NotImplementedError( + "Dialect '%s' does not support empty set expression." % + self.dialect.name + ) + def visit_binary(self, binary, override_operator=None, eager_grouping=False, **kw): -- cgit v1.2.1