Project

General

Profile

« Previous | Next » 

Revision 2202

sql.py: put_table(): insert_() and mk_select_() take distinct_on param

View differences:

sql.py
786 786
            run_query_into(db, query, params, into_ref=pkeys_ref)
787 787
            pkeys_table_exists_ref[0] = True
788 788
    
789
    def mk_select_(cols):
790
        return mk_select(db, insert_joins, cols, limit=limit, start=start,
791
            table_is_esc=table_is_esc)
789
    def mk_select_(cols, distinct_on=None):
790
        return mk_select(db, insert_joins, cols, distinct_on, limit=limit,
791
            start=start, table_is_esc=table_is_esc)
792 792
    
793 793
    out_pkeys_ref = ['out_pkeys_'+temp_suffix]
794
    def insert_():
794
    def insert_(distinct_on=None):
795 795
        '''Inserts and capture output pkeys.'''
796 796
        cur = insert_select(db, out_table, mapping.keys(),
797
            *mk_select_(mapping.values()), returning=out_pkey,
797
            *mk_select_(mapping.values(), distinct_on), returning=out_pkey,
798 798
            into_ref=out_pkeys_ref, recover=True, table_is_esc=table_is_esc)
799 799
        if row_ct_ref != None and cur.rowcount >= 0:
800 800
            row_ct_ref[0] += cur.rowcount

Also available in: Unified diff