feat: with real time streaming

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-12-11 22:31:52 +01:00
commit fc27206708
4 changed files with 169 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
#!/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