1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import psycopg2
import os
import os.path
import pdb
if os.name =='nt':
root = "//WDsentinel/share/CorpCDOs/data/markit"
elif os.name == 'posix':
root = '/home/share/CorpCDOS/data/markit'
conn = psycopg2.connect(database="ET",
user="et_user",
password="Serenitas1",
host="192.168.1.108")
cursor = conn.cursor()
cursor.execute("SELECT dealname FROM latest_clo_universe")
dealnames = cursor.fetchall()
for dealname in dealnames:
cursor.execute("SELECT p_cusip, p_curr_subordination, p_curr_thickness from et_deal_subordination(%s)",
dealname)
# cursor.executemany("UPDATE et_cusip_model_numbers SET subordination = %s, thickness = %s WHERE cusip = %s",
# cursor.fetchall())
data = cursor.fetchall()
data = [ t + dealname for t in data]
cursor.executemany("INSERT INTO et_cusip_model_numbers(cusip, subordination, thickness, dealname) "
"VALUES(%s, %s, %s, %s)", data)
conn.commit()
conn.close()
print("done")
|