Project

General

Profile

« Previous | Next » 

Revision 9511

bin/tnrs_db: removed no longer needed explicit appending of derived cols, and instead use append_csv()'s new support for importing CSVs whose columns are a subset of the full table

View differences:

tnrs_db
28 28
tnrs_input = sql_gen.Table('tnrs_input_name')
29 29
tnrs_data = sql_gen.Table('tnrs')
30 30
time_col_name = 'Time_submitted'
31
added_col_names = ['Accepted_scientific_name', 'Max_score']
32 31

  
33 32
def main():
34 33
    # Input
......
80 79
        log('Storing TNRS response data')
81 80
        reader, header = csvs.reader_and_header(stream)
82 81
        header.insert(0, time_col_name)
83
        added_cols_idx = len(header)
84
        header += added_col_names
85 82
        reader = csvs.ColInsertFilter(reader, now_str)
86
        reader = csvs.ColInsertFilter(reader, None, added_cols_idx,
87
            len(added_col_names))
88 83
        sql_io.append_csv(db, tnrs_data, reader, header)
89 84

  
90 85
main()

Also available in: Unified diff