sql stuff in
This commit is contained in:
50
setup.sql
Normal file
50
setup.sql
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
USE minecraft;
|
||||||
|
|
||||||
|
CREATE TABLE mc_client_events (
|
||||||
|
user_id String,
|
||||||
|
|
||||||
|
timestamp DateTime,
|
||||||
|
|
||||||
|
event_type Enum8(
|
||||||
|
'start' = 1,
|
||||||
|
'end' = 2
|
||||||
|
),
|
||||||
|
|
||||||
|
log_source LowCardinality(String) -- latest.log or YYYY-MM-DD-n.log.gz
|
||||||
|
)
|
||||||
|
ENGINE = MergeTree
|
||||||
|
PARTITION BY toDate(timestamp)
|
||||||
|
ORDER BY (user_id, timestamp);
|
||||||
|
|
||||||
|
CREATE TABLE mc_chat_events (
|
||||||
|
user_id String,
|
||||||
|
|
||||||
|
timestamp DateTime,
|
||||||
|
|
||||||
|
sender String,
|
||||||
|
message String
|
||||||
|
)
|
||||||
|
ENGINE = MergeTree
|
||||||
|
PARTITION BY toDate(timestamp)
|
||||||
|
ORDER BY (user_id, timestamp);
|
||||||
|
|
||||||
|
CREATE TABLE mc_activity_events (
|
||||||
|
user_id String,
|
||||||
|
|
||||||
|
timestamp DateTime,
|
||||||
|
|
||||||
|
event_type Enum8(
|
||||||
|
'command' = 1,
|
||||||
|
'death' = 2,
|
||||||
|
'dimension' = 3,
|
||||||
|
'other' = 4
|
||||||
|
),
|
||||||
|
|
||||||
|
confidence Float32
|
||||||
|
)
|
||||||
|
ENGINE = MergeTree
|
||||||
|
PARTITION BY toDate(timestamp)
|
||||||
|
ORDER BY (user_id, timestamp);
|
||||||
|
|
||||||
|
|
||||||
|
SHOW TABLES;
|
||||||
@@ -8,7 +8,8 @@ int main (int argc, char *argv[]) {
|
|||||||
if(log_path.empty()) throw std::runtime_error("your dumbass can't put in a path");
|
if(log_path.empty()) throw std::runtime_error("your dumbass can't put in a path");
|
||||||
std::string clickhouse_username = config["clickhouse"]["username"].value_or("");
|
std::string clickhouse_username = config["clickhouse"]["username"].value_or("");
|
||||||
std::string clickouse_password = config["clickhouse"]["password"].value_or("");
|
std::string clickouse_password = config["clickhouse"]["password"].value_or("");
|
||||||
if(clickhouse_username.empty() || clickouse_password.empty()) throw std::runtime_error("put the creds in the right place idiot");
|
std::string clickhouse_db = config["clickhouse"]["db"].value_or("");
|
||||||
|
if(clickhouse_username.empty() || clickouse_password.empty() || clickhouse_db.empty()) throw std::runtime_error("put the creds in the right place idiot");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user