-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreatDatabase.dos
More file actions
73 lines (66 loc) · 1.76 KB
/
creatDatabase.dos
File metadata and controls
73 lines (66 loc) · 1.76 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// dropDatabase("dfs://dayFactorDB")
db = database("dfs://dayFactorDB")
dropTable(db,"factor_basic")
//为提高效率建议两个数据库dayFactorDB存放因子,k_day_level存放交易数据
create database "dfs://dayFactorDB"
partitioned by RANGE(date(datetimeAdd(2015.01M,0..25*12,'M'))), VALUE(`f1`f2),
engine='TSDB'
create table "dfs://dayFactorDB"."factor_basic"(
trade_date DATE[comment="时间列", compress="delta"],
ts_code SYMBOL,
pe DOUBLE,
pb DOUBLE,
gpr DOUBLE,
npr DOUBLE,
total_mv DOUBLE,
turn_over DOUBLE,
vol_ratio DOUBLE,
strength DOUBLE,
roe DOUBLE
)
partitioned by trade_date, ts_code,
sortColumns=[`ts_code, `trade_date]
create table "dfs://dayFactorDB"."factor_computed"(
trade_date DATE[comment="时间列", compress="delta"],
ts_code SYMBOL,
value DOUBLE,
factorname SYMBOL
)
partitioned by trade_date, factorname,
sortColumns=[`ts_code, `trade_date],
keepDuplicates=ALL,
sortKeyMappingFunction=[hashBucket{, 500}]
create database "dfs://k_day_level"
partitioned by RANGE(2005.01M + (0..35)*12)
engine='OLAP'
create table "dfs://k_day_level"."k_day"(
ts_code SYMBOL
trade_date TIMESTAMP
open DOUBLE
high DOUBLE
low DOUBLE
close DOUBLE
vol DOUBLE
)
partitioned by trade_date
create table "dfs://k_day_level"."trade_cal"(
exchange SYMBOL
cal_date TIMESTAMP
is_open INT
pretrade_date TIMESTAMP
)
partitioned by cal_date
create table "dfs://k_day_level"."suspend_d"(
ts_code SYMBOL
trade_date TIMESTAMP
suspend_type SYMBOL
)
partitioned by trade_date
create table "dfs://k_day_level"."company_detail"(
ts_code SYMBOL
trade_date TIMESTAMP
name SYMBOL
industry SYMBOL
list_date TIMESTAMP
)
partitioned by trade_date