Revision 7291
Added by Aaron Marcuse-Kubitza almost 12 years ago
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 |
name_col_name = 'Accepted_scientific_name'
|
|
31 |
added_col_names = ['Accepted_scientific_name']
|
|
32 | 32 |
|
33 | 33 |
def main(): |
34 | 34 |
# Input |
... | ... | |
80 | 80 |
log('Storing TNRS response data') |
81 | 81 |
reader, header = csvs.reader_and_header(stream) |
82 | 82 |
header.insert(0, time_col_name) |
83 |
name_col_idx = len(header)
|
|
84 |
header.append(name_col_name)
|
|
83 |
added_cols_idx = len(header)
|
|
84 |
header += added_col_names
|
|
85 | 85 |
reader = csvs.ColInsertFilter(reader, lambda row, row_num: now_str) |
86 | 86 |
reader = csvs.ColInsertFilter(reader, lambda row, row_num: None, |
87 |
name_col_idx)
|
|
87 |
added_cols_idx, len(added_col_names))
|
|
88 | 88 |
sql_io.append_csv(db, tnrs_data, reader, header) |
89 | 89 |
|
90 | 90 |
main() |
Also available in: Unified diff
tnrs_db: Support multiple appended columns in the tnrs table