kafka_fdw
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
kafka_fdw | 0.0.3 | FDW | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 8730 | kafka_fdw | No | Yes | No | Yes | No | Yes | - |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.0.3 | 1817161514 | kafka_fdw | - |
| RPM | PIGSTY | 0.0.3 | 1817161514 | kafka_fdw_$v | - |
| DEB | PIGSTY | 0.0.3 | 1817161514 | postgresql-$v-kafka-fdw | - |
Build
You can build the RPM / DEB packages for kafka_fdw using pig build:
Install
You can install kafka_fdw directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Syntax:
Source: README
kafka_fdw is a foreign data wrapper that exposes Kafka messages as PostgreSQL foreign tables. The upstream README explicitly warns that the project is not yet production ready.
Server and Mapping
Define a foreign server with the Kafka broker list, then add a user mapping:
Foreign Tables
Kafka foreign tables must declare two metadata columns, one marked with partition 'true' and one marked with offset 'true'. The remaining columns describe the message payload.
CSV Messages
For CSV, columns are mapped by position. Upstream notes that schema enforcement depends on the message writer, so strict parsing and junk-handling options matter when input quality is uncertain.
JSON Messages
For JSON, each column can map to an object key with the json option. The current implementation supports JSON objects, not top-level JSON arrays.
Querying and Producing
The offset and partition columns are special, and the upstream README recommends specifying them in queries whenever possible:
Messages can also be produced with INSERT statements. If a partition value is supplied, it is used; otherwise Kafka’s builtin partitioner chooses one:
Error Handling
The default behavior is permissive:
- missing trailing columns are treated as
NULL - extra fields are ignored
- unparsable values still raise errors by default
Relevant table options and helper columns include:
strict 'true'to reject column count mismatchesignore_junk 'true'to set malformed values toNULL- columns marked
junk 'true'to capture the original payload - columns marked
junk_error 'true'to capture parsing errors
Build Notes
The extension uses librdkafka and the upstream build instructions are the standard:
The test setup assumes Kafka on localhost:9092 and ZooKeeper on localhost:2181.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)