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.
Run the exporter
Section titled “Run the exporter”| 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.
How rows reach the warehouse
Section titled “How rows reach the warehouse”[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.
Auto-ingest
Section titled “Auto-ingest”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(default5m), andplansays so. A busy stream always has files waiting, so the warehouse resumes at every check. Snowflake bills each resume for at least 60 seconds: at5m, about 12 billed minutes an hour. Use a dedicated X-Small warehouse with a shortAUTO_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 fillsmax_pending_filesin that time pauses; raise it, or lowerpending_check_afterat 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 followson_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.
Databricks
Section titled “Databricks”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_idandclient_secret. Zerobus Ingest doesn’t take personal access tokens. - The SQL warehouse in
warehouse_idrunsplan,applyandCOPY INTO, not Zerobus Ingest. - For
none, setzerobus_endpoint. The service principal needs the workspace access entitlement,USE CATALOG,USE SCHEMA, andMODIFYandSELECTon 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_bytesfollowsoversized. - For
s3, create a Unity Catalog storage credential and an external location covering the bucket andprefix, and grant the service principalREAD FILESon it. The exporter writes with the AWS credentials in its environment or shared credentials file. - Files are Parquet.
staging.format = "json",load = "snowpipe",s3.stageands3.auto_ingestare refused. - Catalog, schema, table and volume names are lower case.
BigQuery
Section titled “BigQuery”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 needsroles/bigquery.dataEditoron the dataset androles/bigquery.jobUseron the project; forgcs, alsoroles/storage.objectAdminon the bucket (or on itsprefix). - The dataset must exist in
location;applycreates the tables in it. - BigQuery runs at most 1,500 load jobs per table a day. On
internalandgcseach batch is one load job, and the exporter starts a table’s next job at least 60 seconds after its last, whatevermax_agesays;plannotes the streams this pacing slows. Usemax_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"andload = "snowpipe"are refused. - Table and envelope column names are lower case.