Skip to content

Kafka exporter

Kafka topic naming

How Kafka topics map to Snowflake, Databricks or BigQuery tables, stages, volumes, pipes and consumer groups.

Each topic exports to a table. [naming] decides which, in this order:

  1. An exact entry in [naming.map].
  2. The first [[naming.rules]] entry whose match fits the topic.
  3. The default rule: strip strip_prefix, upper-case, . becomes __, other symbols _.

On Databricks and BigQuery, table and volume names are then lower case: shop.orders exports to shop__orders.

Several topics can share a table through rules or map entries, but not through the default rule: that fails the configuration. Topics whose names differ only in case or punctuation can’t share a table.

[naming]
strip_prefix = "shop."
unmatched = "default"
[[naming.rules]]
match = "shop.{service}_{variant}.{kind}"
table = "{service}__{kind}"
[naming.map]
"shop.legacy-orders" = "ORDERS_V1"

sqlload tables shows the result before anything connects. With the repository’s example configuration and a file of topic names:

$ sqlload tables --topics-file topics.txt
shop.legacy-orders ORDERS_V1 orders_v1 sqlload-orders_v1
shop.orders_v2.events ORDERS__EVENTS orders__events sqlload-orders__events
shop.payments_v1.events PAYMENTS__EVENTS payments__events sqlload-payments__events
Key Default Meaning
strip_prefix none Removed from the topic before the default rule.
table_prefix "" Put in front of every table name. {stream}, and so the default consumer group, leaves it out.
rules none [[naming.rules]] entries, tried in order. match is a pattern: {name} captures text without dots, {name*} any text, dots included, * matches anything. table is a template of the captures, or skip = true leaves the topic out.
map none Exact topic names to table names. These win over rules.
unmatched default A topic no rule or map entry names: default applies the default rule, fail stops.
fallback none The table for topics whose derived name isn’t a valid identifier, instead of failing.
stage {table}_SQLLOAD_STAGE The stage name, for staged files; on Databricks, the volume for internal.
pipe {table}_SQLLOAD_PIPE Snowflake: the pipe name, for Snowpipe loads.
streaming_pipe {table}-STREAMING Snowflake: the pipe Snowpipe Streaming writes through.

Name templates, and source.consumer_group (default sqlload-{stream}), can use {table}, the table name; {table_flat}, the table name with __ as _; and {stream}, the table name in lower case without table_prefix.