Back to Clickhouse

ProtobufList

docs/en/interfaces/formats/Protobuf/ProtobufList.md

26.4.1.1-new1.0 KB
Original Source

import CloudNotSupportedBadge from '@theme/badges/CloudNotSupportedBadge';

<CloudNotSupportedBadge/>
InputOutputAlias

Description {#description}

The ProtobufList format is similar to the Protobuf format but rows are represented as a sequence of sub-messages contained in a message with a fixed name of "Envelope".

Example usage {#example-usage}

For example:

sql
SELECT * FROM test.table FORMAT ProtobufList SETTINGS format_schema = 'schemafile:MessageType'
bash
cat protobuflist_messages.bin | clickhouse-client --query "INSERT INTO test.table FORMAT ProtobufList SETTINGS format_schema='schemafile:MessageType'"

Where the file schemafile.proto looks like this:

capnp
syntax = "proto3";
message Envelope {
  message MessageType {
    string name = 1;
    string surname = 2;
    uint32 birthDate = 3;
    repeated string phoneNumbers = 4;
  };
  MessageType row = 1;
};

Format settings {#format-settings}