• Dewi Oktaviani @oktavianidewi ·

    CREATE TABLE cl_test7 ON CLUSTER '{cluster}' ( id String, month_bucket Int32, process_at DateTime, environment_id String, channel_id String, user_id String, bot_id String, bot_revision String, channel_type String, created_at DateTime, day_bucket String, duration Int32, flow String, intent String, logname String, message_type String, messages String, others String, prev_session String, received_at DateTime, responses String, sent_at DateTime, session String, session_start DateTime, state String, text String, user_created_at DateTime ) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{cluster}/{shard}/cl_test7', '{replica}') PARTITION BY toYYYYMM(process_at) ORDER BY (process_at, environment_id, channel_id, id);

    insert into cl_test10 ( id, month_bucket, process_at, environment_id, channel_id, user_id, bot_id, bot_revision, channel_type, created_at, day_bucket, duration, flow, intent, logname, message_type, messages, others, prev_session, received_at, responses, sent_at, session, session_start, state, text, user_created_at) select * from conversation_logs_stream_update where process_at >= toDate('2021-12-01') and process_at < toDate('2021-12-03');

    select count(distinct user_id) as counts from cl_test5 where process_at >= toDateTime(1638403199000/1000) AND process_at < toDateTime(1638489596000/1000) AND message_type != 'command' AND environment_id = '1a30f39f-f305-473f-813f-8d16b56c2d7d' AND channel_id ='38565907-c95f-4301-9797-c1a713613934'

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment