Events table (ordered by insertion):
CREATE TABLE events (
id UInt64,
ts DateTime64(3),
data TEXT
)
ENGINE=MergeTree()
ORDER BY tuple()
Service table:
CREATE TABLE service1 (
id UInt64,
ts DateTime64(3),
data TEXT
)
ENGINE=URL('https://service1.example.com/api/enrich', JSONEachRow)
Mat view:
CREATE MATERIALIZED VIEW events_enrich
TO service1 AS
SELECT
id,
ts,
data
FROM events
What will happen:
- rows get inserted into
events
- mat view will push them into the API endpoint (in
JSONEachRow
format) using POST HTTP request. - rows will be batched: multiple rows per one POST.
- ClickHouse will not wait for any data in response, API should only answer with
200 ok
and that's it.