Skip to main content

Fast python conversion from protobuf to arrow using rust

Project description

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

ptars

Protobuf to Arrow, using Rust

Example

Take a protobuf:

message SearchRequest {
  string query = 1;
  int32 page_number = 2;
  int32 result_per_page = 3;
}

And convert serialized messages directly to pyarrow.RecordBatch:

messages = [
    SearchRequest(
        query="protobuf to arrow",
        page_number=0,
        result_per_page=10,
    ),
    SearchRequest(
        query="protobuf to arrow",
        page_number=1,
        result_per_page=10,
    ),
]
payloads = [message.SerializeToString() for message in messages]

pool = HandlerPool()
handler = pool.get_for_message(SearchRequest.DESCRIPTOR)
record_batch = handler.list_to_record_batch(payloads)
query page_number result_per_page
protobuf to arrow 0 10
protobuf to arrow 1 10

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

ptars-0.0.2rc0.tar.gz (78.8 kB view hashes)

Uploaded Source

Built Distributions

ptars-0.0.2rc0-cp311-none-win_amd64.whl (2.1 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

ptars-0.0.2rc0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

ptars-0.0.2rc0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.1 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

ptars-0.0.2rc0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl (3.5 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.5+ i686

ptars-0.0.2rc0-cp311-cp311-macosx_10_12_x86_64.whl (2.3 MB view hashes)

Uploaded CPython 3.11 macOS 10.12+ x86-64

ptars-0.0.2rc0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (4.3 MB view hashes)

Uploaded CPython 3.11 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64

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