kafka_fdw
kafka_fdw : kafka Foreign Data Wrapper for CSV formatted messages
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 8730 | kafka_fdw | kafka_fdw | 0.0.3 |
FDW | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | pgmqtt wal2json decoderbufs pgq test_decoding pgoutput pg_protobuf pgproto hdfs_fdw |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.0.3 |
18 17 16 15 14 | kafka_fdw |
- |
| RPM | PIGSTY | 0.0.3 |
18 17 16 15 14 | kafka_fdw_$v |
- |
| DEB | PIGSTY | 0.0.3 |
18 17 16 15 14 | postgresql-$v-kafka-fdw |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| el8.aarch64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| el9.x86_64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| el9.aarch64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| el10.x86_64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| el10.aarch64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| d12.x86_64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| d12.aarch64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| d13.x86_64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| d13.aarch64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| u22.x86_64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| u22.aarch64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| u24.x86_64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| u24.aarch64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| u26.x86_64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
| u26.aarch64 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 | PIGSTY 0.0.3 |
Source
github.com/adjust/kafka_fdw
kafka_fdw-0.0.3.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
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.