Skip to main content

Polars io-plugin for reading and writing avro files

Project description

polars-avro

A polars io plugin for reading and writing avro files.

Python Usage

from polars_avro import scan_avro, read_avro, write_avro

lazy = scan_avro(path)
frame = read_avro(path)
write_avro(frame, path)

Rust Usage

There are two main objects exported in rust: AvroScanner for creating an iterator of DataFrames from polars ScanSources, and sink_avro for writing an iterator of DataFrames to a Writeable.

use polars_avro::{AvroScanner, sink_avro, WriteOptions};

let scanner = AvroScanner::new_from_sources(
    &ScanSources::Paths(...),
    1024,  //  batch size
    false, // expand globs
    None,  // cloud options
).unwrap()

sink_avro(
    scanner.map(Result::unwrap),
    ..., // impl Write
    WriteOptions::default(),
).unwrap();

ℹ️ Avro supports writing with a fire compression schemes. In rust these features need to be enabled manually, e.g. apache-avro/bzip to enable bzip2 compression. Decompression is handled automatically.

Development

Rust

Standard cargo commands will build and test the rust library.

Python

The python library is built with uv and maturin. Run the following to compile rust for use by python:

For local rust development, run

uv run maturin develop -m Cargo.toml

to build a local copy of the rust interface.

Testing

cargo clippy --all-features
cargo test
uv run ruff format --check
uv run ruff check
uv run pyright
uv run pytest

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

polars_avro-0.1.0.tar.gz (88.0 kB view details)

Uploaded Source

Built Distribution

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

polars_avro-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (35.0 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file polars_avro-0.1.0.tar.gz.

File metadata

  • Download URL: polars_avro-0.1.0.tar.gz
  • Upload date:
  • Size: 88.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.28

File hashes

Hashes for polars_avro-0.1.0.tar.gz
Algorithm Hash digest
SHA256 608a95c8497b01f46ed8db1cac18e2a11a128ea0882ddc8ff3bf09015d5cec94
MD5 3efd830294bf96a3e413b5e41db7da85
BLAKE2b-256 7de0163e0b11221a02a333ed12f879ed99d56ef5651b1f2fdd1d5f9b2ae0e213

See more details on using hashes here.

File details

Details for the file polars_avro-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polars_avro-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aa379f6876d659c9480ded925049c6a34baca253c3e660479603e2011b52aa57
MD5 5ac81f7227f20a7093ba4a90b3aadd58
BLAKE2b-256 b15dafaf5780ed616b7a9f402d763756dde0f1b236154cb9aa9f5cc541b995fb

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