Project

General

Profile

« Previous | Next » 

Revision 3628

sql_io.py: put_table(): Removed into param to set a custom into table name because put_table() now has all the info it needs to generate this name automatically, and callers are no longer providing it

View differences:

sql_io.py
241 241
            str_ += '['+str(out_col)+'='+in_col_str(in_col)+']'
242 242
    return str_
243 243

  
244
def put_table(db, out_table, in_tables, mapping, row_ct_ref=None, into=None,
245
    default=None, col_defaults={}, on_error=exc.raise_):
244
def put_table(db, out_table, in_tables, mapping, row_ct_ref=None, default=None,
245
    col_defaults={}, on_error=exc.raise_):
246 246
    '''Recovers from errors.
247 247
    Only works under PostgreSQL (uses INSERT RETURNING).
248 248
    IMPORTANT: Must be run at the *beginning* of a transaction.
......
251 251
    @param mapping dict(out_table_col=in_table_col, ...)
252 252
        * out_table_col: str (*not* sql_gen.Col)
253 253
        * in_table_col: sql_gen.Col|literal-value
254
    @param into The table to contain the output and input pkeys.
255
        Defaults to `out_table.name+'_pkeys'`.
256 254
    @param default The *output* column to use as the pkey for missing rows.
257 255
        If this output column does not exist in the mapping, uses None.
258 256
    @param col_defaults Default values for required columns.
......
299 297
        mapping = {out_pkey: None} # ColDict will replace with default value
300 298
    
301 299
    if not is_literals:
302
        if into == None:
303
            into = into_table_name(out_table, in_tables0, mapping, is_function)
304
        into = sql_gen.as_Table(into)
300
        into = sql_gen.as_Table(into_table_name(out_table, in_tables0, mapping,
301
            is_function))
305 302
        
306 303
        # Set column sources
307 304
        in_cols = filter(sql_gen.is_table_col, mapping.values())

Also available in: Unified diff