summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-05-08 22:44:06 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-05-08 22:44:06 -0400
commit55eacc8dbea3c3f98197bde9034fd6558fb2bc09 (patch)
treef4fedb84a3cd05166f40c34f6b2e06e5839fa619 /lib/sqlalchemy/sql/compiler.py
parentc8873b31f0c87ba0d1a7518b36af7151dec34be4 (diff)
downloadsqlalchemy-55eacc8dbea3c3f98197bde9034fd6558fb2bc09.tar.gz
- Fixed bug where :meth:`.Table.update` and :meth:`.Table.delete`
would produce an empty WHERE clause when an empty :func:`.and_()` or :func:`.or_()` or other blank expression were applied. This is now consistent with that of :func:`.select`. fixes #3045
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index a7465204a..cd01ea5e5 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -1839,7 +1839,9 @@ class SQLCompiler(Compiled):
text += " " + extra_from_text
if update_stmt._whereclause is not None:
- text += " WHERE " + self.process(update_stmt._whereclause)
+ t = self.process(update_stmt._whereclause)
+ if t:
+ text += " WHERE " + t
limit_clause = self.update_limit_clause(update_stmt)
if limit_clause:
@@ -2261,8 +2263,9 @@ class SQLCompiler(Compiled):
delete_stmt, delete_stmt._returning)
if delete_stmt._whereclause is not None:
- text += " WHERE "
- text += delete_stmt._whereclause._compiler_dispatch(self)
+ t = delete_stmt._whereclause._compiler_dispatch(self)
+ if t:
+ text += " WHERE " + t
if self.returning and not self.returning_precedes_values:
text += " " + self.returning_clause(