Skip to content

DuckDB Extension

Tributary

Read Apache Kafka topics from DuckDB SQL. Inspect messages, snapshot a topic into a table, and join the results with local data.

126,863
extension loads · last 90 days
On this page

Read Kafka messages as rows

Apache Kafka stores streams of messages in topics. Tributary lets a DuckDB query consume records from a topic, inspect their contents, and save or join them using SQL.

Use it to investigate messages, take a bounded snapshot, or combine a topic’s data with reference tables. You supply the broker, topic, and consumer configuration, including authentication where required. Reading a topic with a query does not automatically keep a local table synchronized with future messages.

Example

Read a Kafka topic

Change the topic and broker to match your Kafka cluster. The returned columns describe the messages in that topic.

Before you run it: Provide a reachable Kafka broker and an existing topic. The local address below assumes you already have Kafka running.

Run this example in the DuckDB CLI or a native client.

INSTALL tributary FROM community;
LOAD tributary;

SELECT *
FROM tributary_scan_topic(
  'test-topic', "bootstrap.servers" := 'localhost:9092'
)
LIMIT 10;

Rows depend on the topic. SQL LIMIT caps displayed rows; review scan settings for offsets, partitions, and consumption behavior before using a large or active topic.

Common tasks

Deep Dive

Technical Details

Reference

Extension Contents

Quick reference to all available functions and settings organized by category.

Inspection
tributary_metadata() Object type: Table function Inspect a Kafka cluster without consuming from a specific topic.
tributary_version() Object type: Scalar function Returns the loaded Tributary extension version as a date-stamped build string (e.g.
Reading
tributary_scan_topic() Object type: Table function Read messages from a Kafka topic as DuckDB rows.
Schema Registry
tributary_schema_registry_delete_subject() Object type: Table function Delete a subject and return the versions that were deleted.
tributary_schema_registry_delete_subject_version() Object type: Table function Delete one version of a subject.
tributary_schema_registry_get_schema_by_guid() Object type: Table function Fetch a schema by its GUID.
tributary_schema_registry_get_schema_by_subject_and_id() Object type: Table function Fetch a schema by subject and schema id.
tributary_schema_registry_get_schema_by_version() Object type: Table function Fetch one version of a subject's schema.
tributary_schema_registry_get_schema_latest() Object type: Table function Fetch the latest schema registered under a subject.
tributary_schema_registry_get_schema_latest_json_structure() Object type: Scalar function Convert the latest JSON schema of a subject into a DuckDB JSON structure description, for use with json_transform / from_json.
tributary_schema_registry_register_schema() Object type: Table function Register a schema under a subject and return the registration.
tributary_schema_registry_serialize_json() Object type: Scalar function Encode a JSON value with a JSON schema into the Schema Registry wire format, as a BLOB ready to hand to a Kafka producer.
tributary_schema_registry_subjects() Object type: Table function List the registry's subjects, one row per subject.
tributary_schema_registry_versions() Object type: Table function List the version numbers registered under a subject.
Streaming / Kafka
tributary_cluster Object type: Secret librdkafka options for one Kafka cluster.
tributary_schema_registry Object type: Secret Credentials for a Schema Registry.

API Reference

Function Reference

Security

Secrets

DuckDB secrets for storing the credentials and keys used by the tributary extension.

tributary_cluster

tributary_cluster Secret Streaming / Kafka
Description
Parameters
Parameter bootstrap.servers Type VARCHAR Required Optional Description Comma-separated host:port broker list.
Parameter security.protocol Type VARCHAR Required Optional Description PLAINTEXT, SSL, SASL_PLAINTEXT, or SASL_SSL.
Parameter sasl.mechanism Type VARCHAR Required Optional Description SASL mechanism, e.g. SCRAM-SHA-512.
Parameter sasl.username Type VARCHAR Required Optional Description SASL username (redacted).
Parameter sasl.password Type VARCHAR Required Optional Description SASL password (redacted).
Parameter schema.registry.url Type VARCHAR Required Optional Description Schema Registry URL used to decode JSON-schema topics.
Parameter ... Type VARCHAR Required Optional Description Any other librdkafka global (client) property accepted by tributary_scan_topic.
Examples
1

SASL_SSL cluster

CREATE SECRET prod_kafka (
  TYPE tributary_cluster,
  SCOPE 'kafka://prod',
  "bootstrap.servers" 'broker.example.com:9093',
  "security.protocol" 'SASL_SSL',
  "sasl.mechanism"    'SCRAM-SHA-512',
  "sasl.username"     getenv('KAFKA_USER'),
  "sasl.password"     getenv('KAFKA_PASSWORD')
);

tributary_schema_registry

tributary_schema_registry Secret Streaming / Kafka
Description
Parameters
Parameter basic_auth_username Type VARCHAR Required Optional Description Basic-auth user name.
Parameter basic_auth_password Type VARCHAR Required Optional Description Basic-auth password (redacted).
Parameter bearer_access_token Type VARCHAR Required Optional Description Bearer token (redacted).
Examples
1

Registry with basic auth

CREATE SECRET registry (
  TYPE tributary_schema_registry,
  SCOPE 'https://registry.example.com',
  basic_auth_username 'svc-analytics',
  basic_auth_password getenv('REGISTRY_PASSWORD')
);

Practical Examples

Cookbook

Real-world recipes and patterns for common use cases.

Platform Support

Compatibility

Extension availability may vary by platform and DuckDB version. Check below to ensure this extension supports your environment before installation.

Quick Facts

Release status Experimental
Software License MIT
Pricing Free
Written In C++
Source Available Yes
View on GitHub
Usage
126,863
loads · last 90 days

Platforms

DuckDB 2.0.0

  • Linux x86_64 aarch64
  • Linux (musl) Not available
  • macOS Apple Silicon
  • Windows x86_64
  • WASM Not available
Compiled binary sizes
Platform Architecture Size
Linux x86_64 9.98 MB
Linux aarch64 9.32 MB
macOS Apple Silicon 6.81 MB
Windows x86_64 13.84 MB

Compressed download sizes for the release shown above.

DuckDB & Haybarn

Release calendar
  • DuckDB v2.0.0 Query.Farm repository Supported

Browser examples use Haybarn-Wasm 1.5.6.

Checked .