aboutsummaryrefslogtreecommitdiffstats
path: root/python/load_intex_collateral.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/load_intex_collateral.py')
-rw-r--r--python/load_intex_collateral.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/load_intex_collateral.py b/python/load_intex_collateral.py
index 4325c9aa..5c710920 100644
--- a/python/load_intex_collateral.py
+++ b/python/load_intex_collateral.py
@@ -38,7 +38,7 @@ def upload_data(dealnames, workdate, conn, cursor):
#dealname, updatedate = line.rstrip().split()
# updatedate = datetime.datetime.strptime(updatedate, '%m/%d/%Y')
#dealname = dealname.upper() + ",AD.txt
- with open( os.path.join(common.root, "data", "Collaterals_" + workdate, dealname.upper() + "_AD.txt"), "r") as fh:
+ with open( os.path.join(common.root, "data", "Collaterals_" + workdate, dealname.upper() + "_AD.txt"), "r", encoding='windows-1252') as fh:
dr = csv.DictReader(fh, dialect = 'excel-tab')
missingfields = set(fields) - set(dr.fieldnames)
if "LoanX ID" in missingfields:
@@ -61,7 +61,7 @@ def upload_data(dealnames, workdate, conn, cursor):
print("dubious id found: {0}".format(line['LoanX ID']))
line['LoanX ID'] = line['LoanX ID'][:8]
# make sure the string is utf8 safe
- line['Issuer'] = line['Issuer'].decode('windows-1252')
+ line['Issuer'] = line['Issuer']
if 'Reinvest Collat' not in missingfields and \
line['Reinvest Collat'].upper() == 'Y' or line['Issuer'] == '':
# assume it's a reinvestment asset
@@ -107,7 +107,7 @@ def upload_data(dealnames, workdate, conn, cursor):
sqlstr = "SELECT count(*) FROM et_collateral where dealname = %s and updatedate= %s"
cursor.execute(sqlstr, (dealname, updatedate))
currlen = cursor.fetchone()[0]
- if currlen <> len(data):
+ if currlen != len(data):
print("{0} has {1} rows in the database and current collateral file has {2}".format(dealname, currlen, len(data)))
sqlstr = "DELETE FROM et_collateral where dealname = %s and updatedate = %s"
cursor.execute(sqlstr, (dealname, updatedate))