Project

General

Profile

« Previous | Next » 

Revision 14816

lib/sql_io.py: null_strs: made it customizable from an env var, since the same list of null_strs doesn't work for all datasources (see #957)

View differences:

trunk/lib/sql_io.py
32 32
    return sql.value(sql.run_query(db, 'SELECT util.table_nulls_mapped__get('
33 33
        +sql_gen.table2regclass_text(db, table)+')'))
34 34

  
35
null_strs = ['', '-', r'\N', 'NULL', 'N/A', 'NA', 'UNKNOWN', 'nulo']
35
null_strs_str_default = r',-,\N,NULL,N/A,NA,UNKNOWN,nulo'
36 36
    # NA: this will remove a common abbr for North America, but we don't use the
37 37
    # continent, so this is OK
38 38

  
39
null_strs_str = os.getenv('null_strs', null_strs_str_default)
40
null_strs = null_strs_str.split(',')
41

  
39 42
def cleanup_table(db, table):
40 43
    '''idempotent'''
41 44
    table = sql_gen.as_Table(table)

Also available in: Unified diff