diff options
Diffstat (limited to 'python/bespoke_utils.py')
| -rw-r--r-- | python/bespoke_utils.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/python/bespoke_utils.py b/python/bespoke_utils.py index 8cf9d4b1..33d9255d 100644 --- a/python/bespoke_utils.py +++ b/python/bespoke_utils.py @@ -126,13 +126,13 @@ def get_bbg_ids( def get_basketid(conn: connection, name: str) -> Tuple[int, int]: with conn.cursor() as c: c.execute("SELECT max(series)+1 FROM index_version where index='BS'") - serie, = c.fetchone() + (serie,) = c.fetchone() c.execute( "INSERT INTO index_version(index, series, version, redindexcode) " "VALUES('BS', %s, 1, %s) RETURNING basketid", (serie, name), ) - basket_id, = c.fetchone() + (basket_id,) = c.fetchone() conn.commit() return serie, basket_id @@ -194,7 +194,12 @@ def new_index_series(conn, basketid, index_type, series): c.executemany( "INSERT INTO basket_constituents VALUES(%s, %s, %s, %s)", [ - (t.company_id, t.seniority, basketid, 1.0) + ( + t.company_id, + "SLA" if t.seniority == "LAC" else t.seniority, + basketid, + 1.0, + ) for t in df.itertuples(index=False) ], ) |
