real-time-analytics-test/config/clickhouse/docker/00_create_nats_table.sh
kjuulh fc27206708
feat: with real time streaming
Signed-off-by: kjuulh <contact@kjuulh.io>
2023-12-11 22:31:52 +01:00

24 lines
531 B
Bash
Executable File

#!/bin/bash
set -e
clickhouse client -n <<-EOSQL
CREATE TABLE nats (
key String,
) ENGINE = NATS
SETTINGS nats_url = 'nats:4222',
nats_username = 'natsadmin',
nats_password = 'natsadmin',
nats_subjects = 'cli.demo',
nats_format = 'JSONEachRow',
date_time_input_format = 'best_effort';
CREATE TABLE daily (key String)
ENGINE = MergeTree() ORDER BY key;
CREATE MATERIALIZED VIEW consumer TO daily
AS SELECT key FROM nats;
SELECT key FROM daily ORDER BY key;
EOSQL