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.

This commit is contained in:
Lance Edgar 2010-04-21 16:58:14 -05:00
parent f6098ce17c
commit efc7b7cc6d

View file

@ -41,9 +41,9 @@ class SQLBase7Compiler(SQLCompiler):
def visit_select(self, select, **kwargs): def visit_select(self, select, **kwargs):
froms = select._get_display_froms() froms = select._get_display_froms()
whereclause = self._get_join_whereclause(froms) whereclause = self._get_join_whereclause(froms)
if whereclause is not None: if whereclause:
select = select.where(whereclause) select = select.where(whereclause)
kwargs['iswrapper'] = getattr(select, '_is_wrapper', False) kwargs['iswrapper'] = getattr(select, '_is_wrapper', False)
return SQLCompiler.visit_select(self, select, **kwargs) return SQLCompiler.visit_select(self, select, **kwargs)
@ -59,8 +59,10 @@ class SQLBase7Compiler(SQLCompiler):
for f in froms: for f in froms:
if isinstance(f, Join): if isinstance(f, Join):
visit_join(f) visit_join(f)
return and_(*clauses) if clauses:
return and_(*clauses)
return None
def visit_ilike_op(self, binary, **kw): def visit_ilike_op(self, binary, **kw):
escape = binary.modifiers.get("escape", None) escape = binary.modifiers.get("escape", None)