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)