Project

General

Profile

« Previous | Next » 

Revision 10188

lib/sql_io.py: cleanup_table(): don't run the slow ALTER TABLE statement again if the table has already been cleaned up. documented that it is idempotent (and actually was before this change as well).

View differences:

lib/sql_io.py
35 35
null_strs = ['', '-', r'\N', 'NULL', 'UNKNOWN', 'nulo']
36 36

  
37 37
def cleanup_table(db, table):
38
    '''idempotent'''
38 39
    table = sql_gen.as_Table(table)
40
    
41
    if table_nulls_mapped__get(db, table): return # already cleaned up
42
    
39 43
    cols = filter(lambda c: sql_gen.is_text_col(db, c),
40 44
        sql.table_cols(db, table))
41 45
    try: pkey_col = sql.table_pkey_col(db, table)
......
62 66
    
63 67
    db.log_debug('Vacuuming and reanalyzing table', level=1.5)
64 68
    sql.vacuum(db, table)
69
    
70
    table_nulls_mapped__set(db, table)
65 71

  
66 72
##### Error tracking
67 73

  

Also available in: Unified diff