Project

General

Profile

« Previous | Next » 

Revision 4140

sql_io.py: put_table(): sql.MissingCastException: Support unknown (None) columns, by casting all columns

View differences:

lib/sql_io.py
521 521
        except sql.MissingCastException, e:
522 522
            log_exc(e)
523 523
            
524
            out_col = e.col
525 524
            type_ = e.type
525
            if e.col == None: out_cols = mapping.keys()
526
            else: out_cols = [e.col]
526 527
            
527
            log_debug('Casting '+strings.as_tt(out_col)+' input to '
528
                +strings.as_tt(type_))
529
            in_col = mapping[out_col]
530
            while True:
531
                try:
532
                    mapping[out_col] = cast_temp_col(db, type_, in_col,
533
                        errors_table_)
534
                    break # cast successful
535
                except sql.InvalidValueException, e:
536
                    log_exc(e)
537
                    
538
                    ignore(in_col, e.value, e)
528
            for out_col in out_cols:
529
                log_debug('Casting '+strings.as_tt(strings.urepr(out_col))
530
                    +' input to '+strings.as_tt(type_))
531
                in_col = mapping[out_col]
532
                while True:
533
                    try:
534
                        mapping[out_col] = cast_temp_col(db, type_, in_col,
535
                            errors_table_)
536
                        break # cast successful
537
                    except sql.InvalidValueException, e:
538
                        log_exc(e)
539
                        
540
                        ignore(in_col, e.value, e)
539 541
        except sql.DuplicateKeyException, e:
540 542
            log_exc(e)
541 543
            

Also available in: Unified diff