Skip to main content

Convert from protobuf to arrow and back

Project description

PyPI Version Python Version Github Stars codecov Build Status Documentation License Downloads Downloads Code style: black snyk

Protarrow

Protarrow is a python library for converting from Protocol Buffers to Apache Arrow and back.

It is used at Tradewell Technologies, to share data between transactional and analytical applications, with little boilerplate code and zero data loss.

Installation

pip install protarrow

Usage

Taking a simple protobuf:

message MyProto {
  string name = 1;
  int32 id = 2;
  repeated int32 values = 3;
}

It can be converted to a pyarrow.Table:

import protarrow

my_protos = [
    MyProto(name="foo", id=1, values=[1, 2, 4]),
    MyProto(name="bar", id=2, values=[3, 4, 5]),
]

table = protarrow.messages_to_table(my_protos, MyProto)
name id values
foo 1 [1 2 4]
bar 2 [3 4 5]

And the table can be converted back to proto:

protos_from_table = protarrow.table_to_messages(table, MyProto)

See the documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

protarrow-0.11.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

protarrow-0.11.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file protarrow-0.11.0.tar.gz.

File metadata

  • Download URL: protarrow-0.11.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.10.16 Linux/6.8.0-1017-azure

File hashes

Hashes for protarrow-0.11.0.tar.gz
Algorithm Hash digest
SHA256 9eeeb2ac29a5f6c4bff6621c87fdf845bae42235f837cee9b7daa1919459ea42
MD5 50fdb128699399565ef435f51cffce9c
BLAKE2b-256 6389cfaf340da53558719acd911a5ed8620c07cda872a0d90f52221b2638776c

See more details on using hashes here.

File details

Details for the file protarrow-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: protarrow-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.10.16 Linux/6.8.0-1017-azure

File hashes

Hashes for protarrow-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d9d7d60e7ea825e47d82e760d6c249fdca469133d34a55dd4a4f0a2146aabcd
MD5 e7cc9ce28ab66eb9de5d1a1f05a8034e
BLAKE2b-256 4f7a7ec68d139fa2c7c38e33c45825a5069f29b17bf134b579a526be2ac71edb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page