real-time-analytics-test/config/clickhouse/docker/00_create_nats_table.sh

24 lines
531 B
Bash
Raw Normal View History

#!/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