Skip to content
DuckDB community extension

protoduck

Deserialize Protocol Buffer messages stored in DuckDB columns

01 / SETUP

Install and load

Run these commands in a Haybarn SQL session. The extension is available from the community repository.

Haybarn 2.0.0 · SQL
INSTALL protoduck FROM community;
LOAD protoduck FROM community;

Using upstream DuckDB? Follow the maintainer’s installation instructions.

02 / QUERY

Usage example

Register a protobuf schema at runtime

SQL
-- Register a protobuf schema at runtime
SELECT proto_schema_add('
    syntax = "proto3";
    package demo;
    message Person {
        string name = 1;
        int32 age = 2;
    }
');

-- Decode a protobuf BLOB to JSON
SELECT proto_to_json(data, 'demo.Person') FROM people;

-- Extract a single field via dot-notation path
SELECT proto_get(data, 'demo.Person', 'name') FROM people;

Provided by fcsnk. Not yet verified on Haybarn 2.0.0.

Sample data & setup

About this extension

ProtoDuck is a DuckDB extension for deserializing Protocol Buffer messages stored directly in table columns (BLOBs), rather than from files. It is aimed at querying protobuf-encoded payloads in data lakes and analytics pipelines.

Schemas are registered at runtime via proto_schema_add (from .proto source) or proto_schema_add_binary (from a compiled FileDescriptorSet). Once registered, messages can be decoded to JSON with proto_to_json / proto_decode, or individual fields can be pulled out with proto_get using a path syntax that supports nested messages, repeated fields (items[0]), and maps (metadata["key"]).

Project overview from the community descriptor.

Documentation and resources

Project and build details
Repository
fcsnk/protoduck
License
MIT
Maintainers
fcsnk
Written in
Rust
Build source
5473d9573eb3
Build definition
Community descriptor