diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/load_indicative.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/python/load_indicative.py b/python/load_indicative.py index 1c8bf770..feae9e0f 100644 --- a/python/load_indicative.py +++ b/python/load_indicative.py @@ -89,7 +89,11 @@ def upload_deal_data(conn, filename): sqlstr = "select dealname, array_agg(\"Latest Update\") from clo_universe group by dealname" with conn.cursor() as c: c.execute(sqlstr) - deallist = dict(c) + deallist1 = dict(c) + sqlstr = "select dealname from deal_indicative" + with conn.cursor() as c: + c.execute(sqlstr) + deallist2 = [d[0] for d in c] conn.commit() with open( filename, "r") as fh: dr = csv.DictReader(fh, dialect='excel-tab') @@ -124,7 +128,7 @@ def upload_deal_data(conn, filename): dealname = line['Deal/Tranche ID'] line['defaultedbal'] = line["CDO Defaulted Security Balance (Reported)"] - if dealname not in deallist: + if dealname not in deallist2: for key in ["Orig Deal Bal", "Tranche Orig Bal"]: if line[key]: line[key] = sanitize_float(line[key]) @@ -140,7 +144,7 @@ def upload_deal_data(conn, filename): except (psycopg2.DataError, KeyError) as detail: logging.error(detail) pdb.set_trace() - if dealname not in deallist or line['Latest Update'] not in deallist[dealname]: + if dealname not in deallist1 or line['Latest Update'] not in deallist1[dealname]: sqlstring = \ "INSERT INTO clo_universe " \ "VALUES (%(Deal/Tranche ID)s, %(Curr Deal Bal)s, %(Tranche Curr Bal)s, " \ |
