Project

General

Profile

« Previous | Next » 

Revision 2265

sql_gen.py: Join.to_str(): Fixed bug where USING syntax could not be used for filter_out join type, because a separate right column is required for filtering

View differences:

lib/sql_gen.py
160 160
            cond = as_ValueCond(right_table_col, self.table)
161 161
            return cond.to_str(db, as_Col(left_table_col, left_table))
162 162
        
163
        # Create join condition and determine join type
164
        if reduce(operator.and_, (v is join_using for v in joins.itervalues())):
163
        # Create join condition
164
        type_ = self.type_
165
        if type_ is not filter_out and reduce(operator.and_,
166
            (v is join_using for v in joins.itervalues())):
165 167
            # all cols w/ USING, so can use simpler USING syntax
166 168
            join_cond = 'USING ('+(', '.join(joins.iterkeys()))+')'
167 169
        else: join_cond = 'ON '+(' AND '.join(map(join, joins.iteritems())))
168 170
        
169 171
        # Create join
170
        type_ = self.type_
171 172
        if type_ is filter_out: type_ = 'LEFT'
172 173
        return type_+' JOIN '+table+' '+join_cond
173 174

  

Also available in: Unified diff