infra: add clickhouse storage and schema initialization
This commit is contained in:
@@ -2,31 +2,39 @@ CREATE DATABASE IF NOT EXISTS telecom;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS telecom.cdr_records
|
||||
(
|
||||
-- Identifiers
|
||||
cdr_id UUID,
|
||||
raw_id String,
|
||||
|
||||
-- Subscriber
|
||||
msisdn String,
|
||||
imsi String,
|
||||
|
||||
-- Session metadata
|
||||
service_type LowCardinality(String),
|
||||
radio_access_type LowCardinality(String),
|
||||
cell_id LowCardinality(String),
|
||||
|
||||
-- Traffic
|
||||
bytes_uploaded UInt64,
|
||||
bytes_downloaded UInt64,
|
||||
total_bytes UInt64,
|
||||
duration_seconds UInt32,
|
||||
|
||||
-- Timing
|
||||
session_start_time DateTime,
|
||||
session_end_time DateTime,
|
||||
|
||||
-- Network
|
||||
source_ip IPv4,
|
||||
|
||||
processed_at DateTime64(3) DEFAULT now()
|
||||
-- Audit
|
||||
processed_at DateTime64(3) DEFAULT now64(3)
|
||||
)
|
||||
ENGINE = ReplacingMergeTree(processed_at)
|
||||
PARTITION BY toYYYYMM(session_start_time)
|
||||
ORDER BY (
|
||||
ORDER BY
|
||||
(
|
||||
service_type,
|
||||
radio_access_type,
|
||||
cell_id,
|
||||
|
||||
Reference in New Issue
Block a user