clickhouse-docs
clickhouse-docs copied to clipboard
Kafka Connect: schemaless table example
The page at: https://clickhouse.com/docs/integrations/kafka/clickhouse-kafka-connect-sink states that INSERTs can be "schemaless". However, there is no example of what such a target table should look like.
I have the following scenario which I'm trying to solve with this connector:
- An Avro topic which I would like to be parsed by the connector
- The resulting JSON from this should be simply inserted into a table in ClickHouse (with
JSONEachRow) - A materialized view is then used to present users with relevant data from the JSON payload
@jpds If you're using Avro as a format, that would (by definition) be schema based - we make use of the built-in support for Avro to handle conversion. See here for an example configuration for that bit.
The structure of the table should match the data:
{
"test":"things",
"time": "2021-01-01 01:02:03"
}
CREATE TABLE sample (
`test` String,
`time` DateTime
) Engine = MergeTree ORDER BY time
Do you plan on having gaps in the data? I would suggest setting those fields to Nullable (or Default, if that makes sense) - otherwise you could make use of bypassRowBinary to insert as you described.