Convert from protobuf to arrow and back
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file protarrow-0.13.3.tar.gz.
File metadata
- Download URL: protarrow-0.13.3.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.9 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64134d923c49258fd14cc919f6791d0be4939a6779ce7e18578c88fb6c99a702
|
|
| MD5 |
499f4b66b1cd6bac028e8bc3c74dac6b
|
|
| BLAKE2b-256 |
4844665988110e39362d3ced82e4d521094878826e04bb5728ce0232da1c2310
|
File details
Details for the file protarrow-0.13.3-py3-none-any.whl.
File metadata
- Download URL: protarrow-0.13.3-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.9 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33eca5376c5f4d2a268eb5563ac471b6caea417593eaa067c438aa860f3f231a
|
|
| MD5 |
53d789e689ac916458b9e439b2139ccb
|
|
| BLAKE2b-256 |
2a746e32ee235e3a8776451f13593a133413784eeb25b257d12af5f7746f52b9
|