File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ def get_universe_data(start_date: Optional[str] = None,
143143
144144def create_universe_table ():
145145 universe_query = """
146- CREATE TABLE universe (
146+ CREATE TABLE IF NOT EXISTS universe (
147147 date DATE NOT NULL,
148148 ticker VARCHAR(50) NOT NULL,
149149 open NUMERIC(18,6),
@@ -168,7 +168,7 @@ def create_portfolio_tables():
168168 # ===============================
169169
170170 snapshots_query = """
171- CREATE TABLE portfolio_snapshots (
171+ CREATE TABLE IF NOT EXISTS portfolio_snapshots (
172172 date DATE NOT NULL,
173173 portfolio_name VARCHAR(50) NOT NULL,
174174
@@ -194,7 +194,7 @@ def create_portfolio_tables():
194194 """
195195
196196 positions_query = """
197- CREATE TABLE portfolio_positions (
197+ CREATE TABLE IF NOT EXISTS portfolio_positions (
198198 date DATE NOT NULL,
199199 portfolio_name VARCHAR(50) NOT NULL,
200200 ticker VARCHAR(10) NOT NULL,
@@ -219,7 +219,7 @@ def create_portfolio_tables():
219219 """
220220
221221 trades_query = """
222- CREATE TABLE portfolio_trades (
222+ CREATE TABLE IF NOT EXISTS portfolio_trades (
223223 id SERIAL PRIMARY KEY,
224224 date DATE NOT NULL,
225225 portfolio_name VARCHAR(50) NOT NULL,
You can’t perform that action at this time.
0 commit comments