Project

General

Profile

« Previous | Next » 

Revision 2154

sql.py: put_table(): Pass pkeys to run_query_into() by ref so it will be updated if the table name is changed

View differences:

lib/sql.py
673 673
    '''
674 674
    temp_prefix = '_'.join(map(clean_name,
675 675
        [out_table] + list(iters.flatten(mapping.items()))))
676
    pkeys = temp_prefix+'_pkeys'
676
    pkeys_ref = [temp_prefix+'_pkeys']
677 677
    
678 678
    # Join together input tables
679 679
    in_tables = in_tables[:] # don't modify input!
......
706 706
        # Join together out_pkeys and in_pkeys
707 707
        run_query_into(db, *mk_select(db,
708 708
            [in_pkeys, (out_pkeys, {row_num_col: join_using})],
709
            pkeys_cols, start=0), into_ref=[pkeys])
709
            pkeys_cols, start=0), into_ref=pkeys_ref)
710 710
    
711 711
    # Do inserts and selects
712 712
    try: insert_()
......
714 714
        join_cols = util.dict_subset_right_join(mapping, e.cols)
715 715
        joins = in_joins + [(out_table, join_cols)]
716 716
        run_query_into(db, *mk_select(db, joins, pkeys_cols,
717
            table_is_esc=table_is_esc), into_ref=[pkeys], recover=True)
717
            table_is_esc=table_is_esc), into_ref=pkeys_ref, recover=True)
718 718
    
719
    return (pkeys, out_pkey)
719
    return (pkeys_ref[0], out_pkey)
720 720

  
721 721
##### Data cleanup
722 722

  

Also available in: Unified diff