-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCassie.cql
149 lines (134 loc) · 3.1 KB
/
Cassie.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
141
142
143
144
145
146
147
148
149
Cassandra Tables
DESCRIBE KEYSPACES
DESCRIBE KEYSPACE ____
DESCRIBE TABLE ____
CREATE KEYSPACE sdc WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1};
CREATE TABLE reviews (
property_id int,
review_id int,
user_id int,
user_name text,
user_pic text,
review_comment text,
review_time text,
host_id int,
host_name text,
host_pic text,
host_comment text,
host_time text,
rating_communication int,
rating_check int,
rating_clean int,
rating_accuracy int,
rating_location int,
rating_value int,
PRIMARY KEY (property_id, review_id)
);
COPY sampleReviews (
property_id,
review_id,
user_id,
user_name,
user_pic,
review_comment,
review_time,
host_id,
host_name,
host_pic,
host_comment,
host_time,
rating_communication,
rating_check,
rating_clean,
rating_accuracy,
rating_location,
rating_value
) FROM '/Users/hsintung/Desktop/reviews/database/data/xaa' WITH header = false AND DELIMITER = ',';
COPY reviews (
property_id,
review_id,
user_id,
user_name,
user_pic,
review_comment,
review_time,
host_id,
host_name,
host_pic,
host_comment,
host_time,
rating_communication,
rating_check,
rating_clean,
rating_accuracy,
rating_location,
rating_value
) FROM '/home/ubuntu/csv/xaa' WITH header = false AND DELIMITER = ','
COPY reviews (
property_id,
review_id,
user_id,
user_name,
user_pic,
review_comment,
review_time,
host_id,
host_name,
host_pic,
host_comment,
host_time,
rating_communication,
rating_check,
rating_clean,
rating_accuracy,
rating_location,
rating_value
) FROM '/home/ubuntu/csv/xab' WITH header = false AND DELIMITER = ','
-- CREATE A NEW REVIEW
-- INSERT INTO reviews (
-- property_id,
-- review_id,
-- user_id,
-- user_name,
-- user_pic,
-- review_time,
-- review_comment,
-- rating_communication,
-- rating_check,
-- rating_clean,
-- rating_accuracy,
-- rating_location,
-- rating_value,
-- host_id,
-- host_name,
-- host_pic,
-- host_comment,
-- host_time
-- ) VALUES (
-- 20,
-- 50000005,
-- 1000,
-- 'Bro',
-- 'https:s3.amazonaws.com/uifaces/faces/twitter/panghal0/128.jpg',
-- 'Thu Feb 21 2019 09:19:18 GMT-0800 (PST)',
-- 'Hey hey hey it is time to play',
-- 5,
-- 5,
-- 5,
-- 5,
-- 5,
-- 5,
-- 304398,
-- 'Kutch',
-- 'https:s3.amazonaws.com/uifaces/faces/twitter/ehsandiary/128.jpg',
-- '',
-- ''
-- );
-- DELETE review
-- DELETE FROM reviews WHERE property_id = 1 AND review_id = 7;
-- UPDATE review
-- UPDATE reviews SET review_comment = 'This is a profane comment', rating_communication = 1 WHERE property_id = 0 AND review_id = 0;
-- UPDATE review response
-- UPDATE reviews SET host_comment = 'HEY IT WORKSSSSS', host_time = 'Thu Feb 21 2019 09:19:18 GMT-0800 (PST)' WHERE property_id = 9999999 AND review_id = 49999999;
-- DELETE host response
-- UPDATE reviews SET host_comment = '', host_time = '' WHERE property_id = 9999999 AND review_id = 49999999;