Revision 2702
Added by Aaron Marcuse-Kubitza over 12 years ago
sql.py | ||
---|---|---|
1037 | 1037 |
into = into_table_name(out_table, in_tables0, mapping, is_func) |
1038 | 1038 |
into = sql_gen.as_Table(into) |
1039 | 1039 |
|
1040 |
# Set column sources |
|
1041 |
in_cols = filter(sql_gen.is_table_col, mapping.values()) |
|
1042 |
for col in in_cols: |
|
1043 |
if col.table == in_tables0: col.set_srcs(sql_gen.src_self) |
|
1044 |
|
|
1040 | 1045 |
log_debug('Joining together input tables into temp table') |
1041 | 1046 |
# Place in new table for speed and so don't modify input if values edited |
1042 | 1047 |
in_table = sql_gen.Table('in') |
1043 |
flatten_cols = filter(sql_gen.is_table_col, mapping.values()) |
|
1044 |
mapping = dicts.join(mapping, flatten(db, in_table, input_joins, |
|
1045 |
flatten_cols, preserve=[in_pkey_col], start=0)) |
|
1048 |
mapping = dicts.join(mapping, flatten(db, in_table, input_joins, in_cols, |
|
1049 |
preserve=[in_pkey_col], start=0)) |
|
1046 | 1050 |
input_joins = [in_table] |
1047 | 1051 |
db.log_debug('Temp table: '+strings.as_tt(in_table.to_str(db)), level=2) |
1048 | 1052 |
|
... | ... | |
1212 | 1216 |
|
1213 | 1217 |
assert table_row_count(db, into) == table_row_count(db, in_table) |
1214 | 1218 |
|
1215 |
return sql_gen.Col(out_pkey, into) |
|
1219 |
srcs = [] |
|
1220 |
if is_func: srcs = sql_gen.cols_srcs(in_cols) |
|
1221 |
return sql_gen.Col(out_pkey, into, srcs) |
|
1216 | 1222 |
|
1217 | 1223 |
##### Data cleanup |
1218 | 1224 |
|
Also available in: Unified diff
sql.py: put_table(): Track the input column(s) a column is derived from, so that error messages can be attributes to the proper input column(s)