Spaces:
Runtime error
Runtime error
huggingface112
commited on
Commit
•
3718ec9
1
Parent(s):
bfd617d
schema and init script for benchmark_profile table
Browse files- initialize_db.py +4 -0
- table_schema.py +12 -0
initialize_db.py
CHANGED
@@ -26,6 +26,10 @@ def initialize_db():
|
|
26 |
if not _create_table_with_schema(ts.STOCKS_PRICE_TABLE, ts.STOCKS_PRICE_TABLE_SCHEMA):
|
27 |
raise Exception(
|
28 |
f'INITIALIZATION ERROR: cannot create table {ts.STOCKS_PRICE_TABLE} ')
|
|
|
|
|
|
|
|
|
29 |
|
30 |
|
31 |
# allow to be run as script
|
|
|
26 |
if not _create_table_with_schema(ts.STOCKS_PRICE_TABLE, ts.STOCKS_PRICE_TABLE_SCHEMA):
|
27 |
raise Exception(
|
28 |
f'INITIALIZATION ERROR: cannot create table {ts.STOCKS_PRICE_TABLE} ')
|
29 |
+
# initialize benchmark profile table
|
30 |
+
if not _create_table_with_schema(ts.BENCHMARK_TABLE, ts.BENCHMARK_TABLE_SCHEMA):
|
31 |
+
raise Exception(
|
32 |
+
f'INITIALIZATION ERROR: cannot create table {ts.BENCHMARK_TABLE} ')
|
33 |
|
34 |
|
35 |
# allow to be run as script
|
table_schema.py
CHANGED
@@ -37,4 +37,16 @@ STOCKS_PRICE_TABLE_SCHEMA = {
|
|
37 |
'low': float,
|
38 |
'volume': int,
|
39 |
'money': float,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
|
|
37 |
'low': float,
|
38 |
'volume': int,
|
39 |
'money': float,
|
40 |
+
}
|
41 |
+
|
42 |
+
|
43 |
+
BENCHMARK_TABLE = 'benchmark_profile'
|
44 |
+
BENCHMARK_TABLE_SCHEMA = {
|
45 |
+
'date': 'datetime64[ns]',
|
46 |
+
'weight': float,
|
47 |
+
'display_name': str,
|
48 |
+
'ticker': str,
|
49 |
+
'sector': str,
|
50 |
+
'aggregate_sector': str,
|
51 |
+
'name': str
|
52 |
}
|