24 lines
531 B
Bash
Executable File
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
|