-
Notifications
You must be signed in to change notification settings - Fork 10
/
schema.cql
140 lines (128 loc) · 3.27 KB
/
schema.cql
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
* Cassandra Schemas
*
* Import this file into cassandra::
*
* $cqlsh host port -f schema.cql
*
* Or, check schemas using script::
*
* $source env.sh DEV
* $python scripts/checkschema.py
* ...
* $#if there are fix plans in output, review them, and execute them by
* $python scripts/checkschema.py --fix
*/
CREATE KEYSPACE IF NOT EXISTS ataobao2
WITH replication = {'class':'SimpleStrategy', 'replication_factor':3};
/* WITH replication = {'class':'NetworkTopologyStrategy', 'DC1':3, 'DC2':3}; */
USE ataobao2;
CREATE TABLE IF NOT EXISTS shop (
id bigint PRIMARY KEY,
sid bigint,
logo text,
type text,
nick text,
title text,
prov text,
city text,
credit_score int,
num_collects int,
num_products int,
good_rating text,
rating text,
created_at text,
mobile text,
charge text,
promise text,
main_sale text,
);
CREATE TABLE IF NOT EXISTS item (
id bigint PRIMARY KEY,
type text,
cid int,
brand text,
image text,
shopid int,
title text,
oprice float,
price float,
num_collects int,
num_instock int,
num_reviews int,
num_sold30 int,
num_views int,
promo text,
delivery_type int,
soldout boolean,
status text,
credit_score int,
);
CREATE TABLE IF NOT EXISTS item_by_date (
id bigint,
date timestamp,
price float,
num_collects int,
num_instock int,
num_reviews int,
num_sold30 int,
num_views int,
PRIMARY KEY (id, date)
);
CREATE TABLE IF NOT EXISTS shop_by_date (
id bigint,
datestr text,
rating text,
cid int,
brandshare text,
cateshare text,
catetrend text,
sales float,
worth float,
num_collects int,
title text,
good_rating float,
PRIMARY KEY (id, datestr)
);
CREATE TABLE IF NOT EXISTS brand (
name text,
search_index int,
sales_index int,
logo text,
PRIMARY KEY (name)
);
CREATE TABLE IF NOT EXISTS cate (
id int,
pid int,
level int,
name text,
search_index int,
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS brand_by_date (
name text,
datestr text,
cate1 int,
sales float,
share float,
num_shops int,
PRIMARY KEY (name, datestr, cate1)
);
CREATE TABLE IF NOT EXISTS top10 (
datestr text,
field text,
value text,
PRIMARY KEY (datestr, field)
);
CREATE TABLE IF NOT EXISTS blacklist (
type text,
args text,
value text,
PRIMARY KEY (type, args)
);
CREATE TABLE IF NOT EXISTS agghosts (
datestr text,
hosts text,
ready boolean,
PRIMARY KEY (datestr)
);