-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclickhouse_schema.sql
More file actions
40 lines (35 loc) · 1015 Bytes
/
Copy pathclickhouse_schema.sql
File metadata and controls
40 lines (35 loc) · 1015 Bytes
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
CREATE DATABASE IF NOT EXISTS eventDb;
CREATE TABLE IF NOT EXISTS eventDb.conversionEvents
(
sessionId String,
eventType String,
textContent Nullable(String),
customEventType Nullable(String),
timestamp UInt64
)
ENGINE = MergeTree()
PRIMARY KEY (sessionId, eventType);
CREATE TABLE IF NOT EXISTS eventDb.eventTable
(sessionId String, event String)
ENGINE = MergeTree()
PRIMARY KEY (sessionId);
CREATE TABLE IF NOT EXISTS eventDb.eventQueue
(sessionId String, event String)
ENGINE = RabbitMQ SETTINGS
rabbitmq_address = 'amqp://rabbitmq:5672',
rabbitmq_exchange_name = 'test-exchange',
rabbitmq_format = 'JSONEachRow';
CREATE MATERIALIZED VIEW IF NOT EXISTS eventDb.consumer TO eventDb.eventTable
AS SELECT * FROM eventDb.eventQueue;
CREATE TABLE IF NOT EXISTS eventDb.sessionTable
(
sessionId String,
startTime UInt64,
endTime UInt64,
lengthMs UInt64,
date Date,
appName String,
errorCount UInt64
)
ENGINE = MergeTree()
PRIMARY KEY (sessionId);