From efc7b7cc6d4157834e41d508b099c1a97fadeaf1 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 21 Apr 2010 16:58:14 -0500 Subject: [PATCH] Fixed an issue with the dialect's _get_join_whereclause method, where it was causing a dangling "AND" to show up in the resultant query. --- sqlbase7_sa/base.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sqlbase7_sa/base.py b/sqlbase7_sa/base.py index 9392fa9..ae45cd6 100644 --- a/sqlbase7_sa/base.py +++ b/sqlbase7_sa/base.py @@ -41,9 +41,9 @@ class SQLBase7Compiler(SQLCompiler): def visit_select(self, select, **kwargs): froms = select._get_display_froms() whereclause = self._get_join_whereclause(froms) - if whereclause is not None: + if whereclause: select = select.where(whereclause) - + kwargs['iswrapper'] = getattr(select, '_is_wrapper', False) return SQLCompiler.visit_select(self, select, **kwargs) @@ -59,8 +59,10 @@ class SQLBase7Compiler(SQLCompiler): for f in froms: if isinstance(f, Join): visit_join(f) - - return and_(*clauses) + + if clauses: + return and_(*clauses) + return None def visit_ilike_op(self, binary, **kw): escape = binary.modifiers.get("escape", None)