Project

General

Profile

« Previous | Next » 

Revision 2316

sql.py: put_table(): Put together varying insert_select() args using dict instead of individual vars

View differences:

lib/sql.py
779 779
        
780 780
        # Prepare to insert new rows
781 781
        if has_joins:
782
            insert_args = dict()
782 783
            distinct_on = filter(util.is_str, join_cols.values())
783 784
            if not filter_join_added:
784 785
                insert_joins.append(sql_gen.Join(out_table, join_cols,
785 786
                    sql_gen.filter_out))
786 787
                filter_join_added = True
787
            returning = None
788
            into_ref = None
789
        else:
790
            returning = out_pkey
791
            into_ref = out_pkeys_ref
788
        else: insert_args = dict(returning=out_pkey, into_ref=out_pkeys_ref)
792 789
        
793 790
        db.log_debug('Inserting new rows')
794 791
        try:
795 792
            cur = insert_select(db, out_table, mapping.keys(),
796
                *mk_main_select(mapping.values()), returning=returning,
797
                into_ref=into_ref, recover=True)
793
                *mk_main_select(mapping.values()), recover=True, **insert_args)
798 794
        except DuplicateKeyException, e:
799 795
            log_exc(e)
800 796
            

Also available in: Unified diff