Skip to content

Load JSON records from an external Kafka consumer ​

Coordinator DB does not subscribe to Kafka topics. Use an external consumer to read messages, decode their values and submit row batches through the documented SQL interfaces. Keep broker-specific envelopes separate from the fields stored in your table.

Define the message-to-row mapping ​

Create destination columns for the stable event identifier and fields the application will query. Use json_each_row when each decoded message is a named row object. A payload that contains a nested JSON document can retain that field as JSON while other columns remain typed.

Test absent keys, explicit nulls, schema changes and invalid numbers before continuous ingestion. Choose whether malformed messages stop a batch or are handled by the consumer's own rejection workflow. Do not silently turn an invalid record into an empty row.

Design for redelivery ​

Wait for a successful destination response before advancing the consumer's progress. A lost response leaves an ambiguous result, so reconcile stable identifiers before a retry. The database does not atomically commit a Kafka offset alongside a SQL write.

If replacement by identifier is required, stage formatted rows and use a later explicit SQL operation; formatted INSERT input does not accept an ON CONFLICT clause.

See json_each_row, INSERT INTO and transactions.