diff options
| -rw-r--r-- | python/csv_to_db.py | 13 | ||||
| -rw-r--r-- | sql/dawn.sql | 29 |
2 files changed, 41 insertions, 1 deletions
diff --git a/python/csv_to_db.py b/python/csv_to_db.py new file mode 100644 index 00000000..5c0f97aa --- /dev/null +++ b/python/csv_to_db.py @@ -0,0 +1,13 @@ +import pandas as pd + +from serenitas.utils.db import dawn_engine + +df = pd.read_csv("/home/serenitas/flint/irs_ticket.csv") + +df.columns = ( + df.columns.str.replace(" ", "_").str.replace("[()/]", "", regex=True).str.lower() +) + +df.insert(0, "bbg_ticket_id", "test") + +df.to_sql("irs_tickets", con=dawn_engine, index=False, if_exists="append") diff --git a/sql/dawn.sql b/sql/dawn.sql index 10ef7219..b6b7e71f 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -4220,4 +4220,31 @@ CREATE TABLE shocks ( CONSTRAINT shocks_pkey PRIMARY KEY (date, risk_type, spread_shock, strategy, fund) ); -CREATE TYPE risk_type AS ENUM ('HY_EQUIV', 'PNL');
\ No newline at end of file +CREATE TYPE risk_type AS ENUM ('HY_EQUIV', 'PNL'); + +CREATE TABLE irs_tickets ( + bbg_ticket_id text PRIMARY KEY, + "match" text NULL, + side text NULL, + "security" text NULL, + quantity int8 NULL, + price_dec float8 NULL, + cp float8 NULL, + stp_status text NULL, + trade_dt date NULL, + setdt date NULL, + curncy text NULL, + principal float8 NULL, + net float8 NULL, + acc_int float8 NULL, + block_status text NULL, + brkr text NULL, + brkrname text NULL, + figi text NULL, + cusip text NULL, + mat_dt date NULL, + cclear_usiuti text NULL, + "cclear_usiuti.1" text NULL, + account text NULL, + client_fcm float8 NULL +);
\ No newline at end of file |
