Revision 2495
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
869 | 869 |
* out_table_col: sql_gen.Col|str |
870 | 870 |
* in_table_col: sql_gen.Col Wrap literal values in a sql_gen.NamedCol |
871 | 871 |
@param into The table to contain the output and input pkeys. |
872 |
Defaults to `out_table.name+'_pkeys'`.
|
|
872 |
Defaults to `out_table.name+'-pkeys'`.
|
|
873 | 873 |
@return sql_gen.Col Where the output pkeys are made available |
874 | 874 |
''' |
875 | 875 |
out_table = sql_gen.as_Table(out_table) |
876 | 876 |
for in_table_col in mapping.itervalues(): |
877 | 877 |
assert isinstance(in_table_col, sql_gen.Col) |
878 |
if into == None: into = out_table.name+'_pkeys'
|
|
878 |
if into == None: into = out_table.name+'-pkeys'
|
|
879 | 879 |
into = sql_gen.as_Table(into) |
880 | 880 |
|
881 | 881 |
def log_debug(msg): db.log_debug(msg, level=1.5) |
... | ... | |
894 | 894 |
|
895 | 895 |
log_debug('Joining together input tables into temp table') |
896 | 896 |
# Place in new table for speed and so don't modify input if values edited |
897 |
in_table = sql_gen.Table(into.name+'_in')
|
|
897 |
in_table = sql_gen.Table(into.name+'-input')
|
|
898 | 898 |
flatten_cols = filter(sql_gen.is_table_col, mapping.values()) |
899 | 899 |
mapping = dicts.join(mapping, flatten(db, in_table, input_joins, |
900 | 900 |
flatten_cols, preserve=[in_pkey_col], start=0)) |
... | ... | |
945 | 945 |
|
946 | 946 |
# Do inserts and selects |
947 | 947 |
join_cols = {} |
948 |
insert_out_pkeys = sql_gen.Table(into.name+'_insert_out_pkeys')
|
|
949 |
insert_in_pkeys = sql_gen.Table(into.name+'_insert_in_pkeys')
|
|
948 |
insert_out_pkeys = sql_gen.Table(into.name+'-insert_out_pkeys')
|
|
949 |
insert_in_pkeys = sql_gen.Table(into.name+'-insert_in_pkeys')
|
|
950 | 950 |
while True: |
951 | 951 |
has_joins = join_cols != {} |
952 | 952 |
|
Also available in: Unified diff
sql.py: put_table(): Use "-" to separate temp table suffixes from into table name