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.7.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

protarrow-0.7.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: protarrow-0.7.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.15 Linux/6.5.0-1025-azure

File hashes

Hashes for protarrow-0.7.0.tar.gz
Algorithm Hash digest
SHA256 3e434495327fa5d23dbaaa5b56bfd6678f8fec6c6a3b351901f5abddc01b988a
MD5 e985eff0fd5cdbde79e48f003ac94fec
BLAKE2b-256 d15a568dc9e4ac1f29ebb647fe8093f1d2d611c2d8828c05c3f71cb7d2e7275f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: protarrow-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.15 Linux/6.5.0-1025-azure

File hashes

Hashes for protarrow-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a2f6143e909ab1731082e6597147e4eeaa33e38032bcc965649590ed4edb30b
MD5 9d45d3ccf20538b6b29176f5f7501a0a
BLAKE2b-256 0ae727f736493e4b5101e19e9f0d049e6bc6785142e098d83090950154f58e67

See more details on using hashes here.

Supported by

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