This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sql
executable file
·68 lines (54 loc) · 2.72 KB
/
init.sql
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
/*
* 🐻❄️🌧️ Noelware Telemetry: Telemetry project for Noelware, to capture anonymous data about the running products.
* Copyright 2022 Noelware <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*********************************************************************************************\
|============================================================================================|
| TELEMETRY SERVER ~ CLICKHOUSE INIT SQL FILE |
| |
| To use this, you must run: |
| $ clickhouse-client --multiquery --queries-file init.sql |
|============================================================================================|
\**********************************************************************************************/
DROP TABLE IF EXISTS telemetry.events;
CREATE TABLE IF NOT EXISTS telemetry."events"(
-- At what time this telemetry event was fired at.
-- clickhouse-rs doesn't support DateTime64, or it doesn't work well.
-- FiredAt DateTime64(9, 'UTC'),
-- The data object that is used. It is a string since clickhouse-rs
-- doesn't support serde.
Data String,
-- The ID of the telemetry event.
ID UInt64,
-- The product that was used for this telemetry event.
Product String,
-- The vendor, always "Noelware"
Vendor String
) ENGINE=MergeTree() ORDER BY (ID, Product, Vendor);
-- -- Use this line for replication.
-- CREATE TABLE IF NOT EXISTS telemetry."events"(
-- -- At what time this telemetry event was fired at.
-- FiredAt DateTime,
-- -- The data object that is used.
-- Data JSON,
-- -- The ID of the telemetry event.
-- ID UInt64,
-- -- The product that was used for this telemetry event.
-- Product String,
-- -- The vendor, always "Noelware"
-- Vendor String,
-- -- The version.
-- version String,
-- ) ENGINE=ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/telemetry', '{replica}', version) PARTITION BY toYYYYMM(FiredAt) ORDER BY (ID, Product, Vendor, FiredAt);