chore: bootstrap project structure
This commit is contained in:
38
infrastructure/clickhouse/init.sql
Normal file
38
infrastructure/clickhouse/init.sql
Normal file
@@ -0,0 +1,38 @@
|
||||
CREATE DATABASE IF NOT EXISTS telecom;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS telecom.cdr_records
|
||||
(
|
||||
cdr_id UUID,
|
||||
raw_id String,
|
||||
|
||||
msisdn String,
|
||||
imsi String,
|
||||
|
||||
service_type LowCardinality(String),
|
||||
radio_access_type LowCardinality(String),
|
||||
cell_id LowCardinality(String),
|
||||
|
||||
bytes_uploaded UInt64,
|
||||
bytes_downloaded UInt64,
|
||||
total_bytes UInt64,
|
||||
duration_seconds UInt32,
|
||||
|
||||
session_start_time DateTime,
|
||||
session_end_time DateTime,
|
||||
|
||||
source_ip IPv4,
|
||||
|
||||
processed_at DateTime64(3) DEFAULT now()
|
||||
)
|
||||
ENGINE = ReplacingMergeTree(processed_at)
|
||||
PARTITION BY toYYYYMM(session_start_time)
|
||||
ORDER BY (
|
||||
service_type,
|
||||
radio_access_type,
|
||||
cell_id,
|
||||
session_start_time,
|
||||
msisdn,
|
||||
cdr_id
|
||||
)
|
||||
TTL session_start_time + INTERVAL 90 DAY
|
||||
SETTINGS index_granularity = 8192;
|
||||
Reference in New Issue
Block a user