aboutsummaryrefslogtreecommitdiffstats
path: root/python/intex/load_intex_collateral.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/intex/load_intex_collateral.py')
-rw-r--r--python/intex/load_intex_collateral.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/python/intex/load_intex_collateral.py b/python/intex/load_intex_collateral.py
index 9567d18c..601c450f 100644
--- a/python/intex/load_intex_collateral.py
+++ b/python/intex/load_intex_collateral.py
@@ -90,7 +90,7 @@ def upload_data(conn, dealnames, workdate):
try:
line['Asset Maturity Date'] = datetime.datetime.strptime(line['Asset Maturity Date'],
'%b %d, %Y').date()
- except ValueError:
+ except (ValueError, TypeError):
line['Asset Maturity Date'] = None
r = [convertToNone(line[field]) for field in fields]
#sometimes the Asset Name is not unique (we add random tag in this case)
@@ -109,17 +109,17 @@ def upload_data(conn, dealnames, workdate):
# sanity check if we already have the data
reinsert = False
if updatedate in old_update_dates:
- sqlstr = "SELECT count(*) FROM et_collateral where dealname = %s and updatedate= %s"
+ sql_str = "SELECT count(*) FROM et_collateral where dealname = %s and updatedate= %s"
with conn.cursor() as c:
- c.execute(sqlstr, (dealname, updatedate))
+ c.execute(sql_str, (dealname, updatedate))
currlen = c.fetchone()[0]
conn.commit()
if currlen != len(data): #then we delete and just reupload
logger.warning("{0} has {1} rows in the database " \
"and current collateral file has {2}".format(dealname, currlen, len(data)))
with conn.cursor() as c:
- sqlstr = "DELETE FROM et_collateral where dealname = %s and updatedate = %s"
- c.execute(sqlstr, (dealname, updatedate))
+ sql_str = "DELETE FROM et_collateral where dealname = %s and updatedate = %s"
+ c.execute(sql_str, (dealname, updatedate))
conn.commit()
reinsert = True