Revision 2574
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
881 | 881 |
* out_table_col: sql_gen.Col|str |
882 | 882 |
* in_table_col: sql_gen.Col Wrap literal values in a sql_gen.NamedCol |
883 | 883 |
@param into The table to contain the output and input pkeys. |
884 |
Defaults to `out_table.name+'-pkeys'`.
|
|
884 |
Defaults to `out_table.name+'_pkeys'`.
|
|
885 | 885 |
@param default The *output* column to use as the pkey for missing rows. |
886 | 886 |
If this output column does not exist in the mapping, uses None. |
887 | 887 |
@param is_func Whether out_table is the name of a SQL function, not a table |
... | ... | |
892 | 892 |
if into == None: |
893 | 893 |
into = out_table.name |
894 | 894 |
if is_func: into += '()' |
895 |
else: into += '-pkeys'
|
|
895 |
else: into += '_pkeys'
|
|
896 | 896 |
into = sql_gen.as_Table(into) |
897 | 897 |
|
898 | 898 |
def log_debug(msg): db.log_debug(msg, level=1.5) |
... | ... | |
913 | 913 |
|
914 | 914 |
log_debug('Joining together input tables into temp table') |
915 | 915 |
# Place in new table for speed and so don't modify input if values edited |
916 |
in_table = sql_gen.Table(into.name.replace('-pkeys', '')+'-input')
|
|
916 |
in_table = sql_gen.Table(into.name.replace('_pkeys', '')+'_input')
|
|
917 | 917 |
flatten_cols = filter(sql_gen.is_table_col, mapping.values()) |
918 | 918 |
mapping = dicts.join(mapping, flatten(db, in_table, input_joins, |
919 | 919 |
flatten_cols, preserve=[in_pkey_col], start=0)) |
... | ... | |
979 | 979 |
|
980 | 980 |
# Do inserts and selects |
981 | 981 |
join_cols = sql_gen.ColDict() |
982 |
insert_out_pkeys = sql_gen.Table(into.name+'-insert_out_pkeys')
|
|
983 |
insert_in_pkeys = sql_gen.Table(into.name+'-insert_in_pkeys')
|
|
982 |
insert_out_pkeys = sql_gen.Table(into.name+'_insert_out_pkeys')
|
|
983 |
insert_in_pkeys = sql_gen.Table(into.name+'_insert_in_pkeys')
|
|
984 | 984 |
while True: |
985 | 985 |
if limit_ref[0] == 0: # special case |
986 | 986 |
log_debug('Creating an empty pkeys table') |
Also available in: Unified diff
sql.py: put_table(): Separate temp table names from into table name with "_" instead of "-" so that quoting the table name will usually be unnecessary