Project

General

Profile

« Previous | Next » 

Revision 3704

sql_io.py: put_table(): ignore_cond(): Fixed bug where if is_literals, need to return NULL, instead of trying to filter invalid rows out of a nonexistant input table

View differences:

lib/sql_io.py
369 369
        limit_ref[0] = 0 # just create an empty pkeys table
370 370
    
371 371
    def ignore_cond(cond, e):
372
        out_table_cols = sql_gen.ColDict(db, out_table)
373
        out_table_cols.update(util.dict_subset_right_join({},
374
            sql.table_cols(db, out_table)))
375
        
376
        in_cols = []
377
        cond = sql.map_expr(db, cond, mapping, in_cols)
378
        cond = sql.map_expr(db, cond, out_table_cols)
379
        
380
        track_data_error(db, errors_table_, sql_gen.cols_srcs(in_cols), None,
381
            e.cause.pgcode,
382
            strings.ensure_newl(e.cause.pgerror)+'condition: '+cond)
383
        
384
        not_cond = sql_gen.NotCond(sql_gen.CustomCode(cond))
385
        log_debug('Ignoring rows where '+strings.as_tt(not_cond.to_str(db)))
386
        sql.delete(db, insert_in_table, not_cond)
372
        if is_literals: remove_all_rows()
373
        else:
374
            out_table_cols = sql_gen.ColDict(db, out_table)
375
            out_table_cols.update(util.dict_subset_right_join({},
376
                sql.table_cols(db, out_table)))
377
            
378
            in_cols = []
379
            cond = sql.map_expr(db, cond, mapping, in_cols)
380
            cond = sql.map_expr(db, cond, out_table_cols)
381
            
382
            track_data_error(db, errors_table_, sql_gen.cols_srcs(in_cols),
383
                None, e.cause.pgcode,
384
                strings.ensure_newl(e.cause.pgerror)+'condition: '+cond)
385
            
386
            not_cond = sql_gen.NotCond(sql_gen.CustomCode(cond))
387
            log_debug('Ignoring rows where '+strings.as_tt(not_cond.to_str(db)))
388
            sql.delete(db, insert_in_table, not_cond)
387 389
    
388 390
    not_null_cols = set()
389 391
    def ignore(in_col, value, e):

Also available in: Unified diff