Revision 4444
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_io.py | ||
---|---|---|
29 | 29 |
for null in null_strs: expr = 'nullif('+expr+', '+db.esc_value(null)+')' |
30 | 30 |
changes = [(v, sql_gen.CustomCode(expr % v.to_str(db))) for v in cols] |
31 | 31 |
|
32 |
sql.update(db, table, changes, in_place=True) |
|
32 |
while True: |
|
33 |
try: |
|
34 |
sql.update(db, table, changes, in_place=True, recover=True) |
|
35 |
break # successful |
|
36 |
except sql.NullValueException, e: |
|
37 |
col, = e.cols |
|
38 |
sql.drop_not_null(db, col) |
|
33 | 39 |
|
34 | 40 |
##### Error tracking |
35 | 41 |
|
Also available in: Unified diff
sql_io.py: cleanup_table(): Handle NullValueExceptions (due to setting values to NULL in a NOT NULL column) by dropping the NOT NULL constraint