diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/db.py | 6 | ||||
| -rw-r--r-- | python/load_intex_collateral.py | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/python/db.py b/python/db.py index 3abe1800..5c85c8cc 100644 --- a/python/db.py +++ b/python/db.py @@ -10,10 +10,10 @@ def with_connection(f): try: rv = f(conn, *args, **kwargs) except Exception as e: + print(e) conn.rollback() - raise - - return rv + else: + return rv return with_connection_ diff --git a/python/load_intex_collateral.py b/python/load_intex_collateral.py index d6224fa2..f03fbffb 100644 --- a/python/load_intex_collateral.py +++ b/python/load_intex_collateral.py @@ -135,9 +135,11 @@ def upload_data(conn, dealnames, workdate): row[0] = row[0] + "_tag_" + str(tag) tag = tag + 1 c.execute(sqlstr, (dealname, updatedate) + tuple(row)) + conn.commit() except TypeError: pdb.set_trace() - conn.commit() + else: + conn.commit() c.close() if __name__ == "__main__": if len(sys.argv) > 1: @@ -148,7 +150,7 @@ if __name__ == "__main__": dealnames = sys.argv[2:] else: dealnames = [re.sub("_AD.txt", "", d).lower() for d in - os.listdir(os.path.join(common.root, "data", "Collaterals_" + workdate))] + os.listdir(os.path.join(root, "data", "Collaterals_" + workdate))] upload_data(conn, dealnames, workdate) conn.close() print("done") |
