Skip to content

Kafka exporter

Run the Kafka exporter

Stream Kafka topics into Snowflake, Databricks (beta) or BigQuery (beta) tables continuously, with a streaming route, staged files or load jobs.

The Kafka exporter reads Kafka topics continuously and writes each one into a Snowflake, Databricks (beta) or BigQuery (beta) table. Its sqlload.toml is described in Kafka exporter configuration.

Step Command
Check the configuration and the connections. sqlload debug
See how topics map to tables, without connecting to the warehouse. See Kafka topic naming. sqlload tables [--topics-file FILE]
Show each topic’s table and the objects it needs. sqlload plan
Create missing tables, and the stages, pipes or volumes the route needs. sqlload apply
Export until stopped, or for --max-duration. sqlload run [--max-duration D] [--shard N]
Show per-partition lag and committed offsets. sqlload status

To split the streams between several instances, set shards under [source] above 1 and run each instance with its own --shard, from 0, or SQLLOAD_SHARD.

[staging] kind chooses the route:

kind Snowflake Databricks (beta) BigQuery (beta)
none Snowpipe Streaming. Zerobus Ingest, rows sent as JSON records. The Storage Write API’s default stream, rows sent as Arrow.
internal Files on a table stage, loaded with Snowpipe or COPY. Parquet files in the stream’s Unity Catalog volume (naming.stage), then one COPY INTO per batch. apply creates the volume; retain prunes its dated folders. One load job per batch, with the Parquet file sent along, so no bucket is needed.
s3 Files in your bucket, loaded with Snowpipe or COPY. Parquet files in your bucket, then COPY INTO, through a Unity Catalog external location you create. Refused.
gcs Refused. Refused. Parquet files in your Cloud Storage bucket, then one load job per batch.

Kafka offsets are committed, oldest batch first, only once the warehouse has the rows: Snowpipe reports the files loaded, COPY INTO or a load job finishes, or the streaming route confirms them. Delivery is at least once: a crash or restart between the write and the Kafka commit replays those rows, so a table can hold a record twice. Dedupe on the topic, partition and offset columns (see Envelope columns).

Replayed rows always load: each run names its staged files afresh, so Snowflake and Databricks don’t skip them as loaded before. A retry within a run reuses the batch’s files, which load once.

With [staging.s3] auto_ingest = true, Snowflake loads each file when the bucket’s event notification reaches the pipe. The exporter confirms these loads from the table’s COPY_HISTORY, so destination.warehouse is required.

  • It queries only while files wait, at most once every pending_check_after (default 5m), and plan says so. A busy stream always has files waiting, so the warehouse resumes at every check. Snowflake bills each resume for at least 60 seconds: at 5m, about 12 billed minutes an hour. Use a dedicated X-Small warehouse with a short AUTO_SUSPEND, such as 60 seconds, or check less often (pending_check_after = "15m").
  • Commits trail the loads by up to pending_check_after. A stream that fills max_pending_files in that time pauses; raise it, or lower pending_check_after at the cost of more warehouse resumes.
  • When the exporter stops, it keeps checking for up to a minute, so a restart doesn’t load the last minutes’ rows again.
  • A file that never shows as loaded, for example because notifications don’t reach the pipe, holds back its batch and every later one, with a warning naming the file. Check SYSTEM$PIPE_STATUS. A file gone from the bucket follows on_load_error.
  • Truncating the table or re-creating the pipe loses the record of files loaded but not yet confirmed. Restart the exporter, which loads their rows again.

The Databricks destination is in beta: tested, but less used than Snowflake. Report rough edges in GitHub issues.

  • Sign in with an OAuth machine-to-machine client (a service principal): client_id and client_secret. Zerobus Ingest doesn’t take personal access tokens.
  • The SQL warehouse in warehouse_id runs plan, apply and COPY INTO, not Zerobus Ingest.
  • For none, set zerobus_endpoint. The service principal needs the workspace access entitlement, USE CATALOG, USE SCHEMA, and MODIFY and SELECT on each table, granted explicitly. Zerobus Ingest may refuse the first token for a new table for a few seconds; the exporter retries, then stops after 4 minutes naming the grants it needs.
  • Zerobus Ingest limits a record to 10 MB; a record over max_request_bytes follows oversized.
  • For s3, create a Unity Catalog storage credential and an external location covering the bucket and prefix, and grant the service principal READ FILES on it. The exporter writes with the AWS credentials in its environment or shared credentials file.
  • Files are Parquet. staging.format = "json", load = "snowpipe", s3.stage and s3.auto_ingest are refused.
  • Catalog, schema, table and volume names are lower case.

The BigQuery destination is in beta: tested, but less used than Snowflake. Report rough edges in GitHub issues.

  • Sign in with a service account’s key (service_account_key). It needs roles/bigquery.dataEditor on the dataset and roles/bigquery.jobUser on the project; for gcs, also roles/storage.objectAdmin on the bucket (or on its prefix).
  • The dataset must exist in location; apply creates the tables in it.
  • BigQuery runs at most 1,500 load jobs per table a day. On internal and gcs each batch is one load job, and the exporter starts a table’s next job at least 60 seconds after its last, whatever max_age says; plan notes the streams this pacing slows. Use max_age = "5m" or more. The Storage Write API (none) has no such limit.
  • A retry doesn’t load a batch twice: it reads the job that may have run instead of starting another. A load job unfinished after 7 minutes stops the exporter; after a restart the batch loads again, so if that job finishes later its rows load twice.
  • BigQuery refuses a Storage Write API request over 10 MB; each holds at most max_request_bytes.
  • Files are Parquet. staging.format = "json" and load = "snowpipe" are refused.
  • Table and envelope column names are lower case.