Revision 3050
Added by Aaron Marcuse-Kubitza over 12 years ago
sql.py | ||
---|---|---|
850 | 850 |
return mk_insert_select(db, errors_table, name_only_cols, |
851 | 851 |
mk_select(db, joins, select_cols, order_by=None)) |
852 | 852 |
|
853 |
def track_data_error(db, errors_table, cols, *args, **kw_args):
|
|
853 |
def track_data_error(db, errors_table, cols, value, error_code, error):
|
|
854 | 854 |
''' |
855 | 855 |
@param errors_table If None, does nothing. |
856 | 856 |
''' |
857 | 857 |
if errors_table == None or cols == (): return |
858 |
run_query(db, mk_track_data_error(db, errors_table, cols, *args, **kw_args), |
|
859 |
cacheable=True, log_level=4) |
|
858 |
|
|
859 |
for col in cols: |
|
860 |
try: |
|
861 |
insert(db, errors_table, dict(column=col.name, value=value, |
|
862 |
error_code=error_code, error=error), recover=True, |
|
863 |
cacheable=True, log_level=4) |
|
864 |
except DuplicateKeyException: pass |
|
860 | 865 |
|
861 | 866 |
def cast(db, type_, col, errors_table=None): |
862 | 867 |
'''Casts an (unrenamed) column or value. |
Also available in: Unified diff
sql.py: track_data_error(): Use for loop and insert() (ignoring DuplicateKeyException) to insert entries into the errors table, to get the same optimization benefits this change provides in other filter-out contexts, and to improve clarity