Skip to main content

arrowmodel

PyPI Python License

Dict-free, single-step conversion from Apache Arrow buffers to Pydantic v2 model instances.

arrowmodel uses a Rust core (via PyO3) to walk Arrow RecordBatch and Table buffers directly, building Pydantic model instances in a tight loop with no intermediate Python dicts. It replaces the to_pylist() + Model.model_construct(**row) two-step with a single call that is roughly 3x faster for flat schemas (benchmark results).

Full Documentation

Quick Start

Installation

pip install arrowmodel

Pre-built wheels are provided for Linux (x86_64, aarch64), macOS on Apple Silicon (arm64) and Windows (x64), so no Rust toolchain is needed there. On any other platform, including Intel Macs, pip builds from source and needs Rust 1.83 or later (install it with rustup).

First Use

import pyarrow as pa
from arrowmodel import ArrowModel


class User(ArrowModel):
    id: int
    name: str
    score: float


batch = pa.record_batch(
    {
        "id": [1, 2, 3],
        "name": ["Alice", "Bob", "Carol"],
        "score": [9.5, 8.0, 7.3],
    }
)

users = User.convert(batch)
# [User(id=1, name='Alice', score=9.5), ...]

Key Features

  • Dict-free conversion: Rust builds each model instance straight from the Arrow buffers, exactly as model_construct would, with no to_pylist() and no intermediate dicts.
  • ~3x faster for flat schemas: Roughly three times the throughput of the pure-Python approach, with less allocation pressure. See the benchmark results and the benchmark script.
  • Three API styles: ArrowModel base class for concise models, ArrowModelConverter for reusable converters, and model_convert/model_iter for one-shot use.
  • Validated mode: Pass validate=True to run full Pydantic validation (model_validate_json) when you need type coercion or custom validators.
  • Pydantic alias support: Resolves validation_alias, alias, field name, and populate_by_name / validate_by_name.
  • Nested models: Arrow Struct columns map to nested Pydantic models, including optional structs and deeply nested hierarchies.
  • Lazy iteration: iter() yields one model at a time, materialising one RecordBatch worth of instances in memory, including from a RecordBatchReader, so a streaming query result never has to fit in memory.
  • Broad type coverage: Integers, floats, decimals, booleans, strings, dates, timestamps, durations, times, binary, lists, structs, maps, dictionaries, unions, intervals, and more.

Input Compatibility

arrowmodel accepts any Arrow record batch, or stream of record batches, via the Arrow PyCapsule Interface:

  • pyarrow -- RecordBatch, Table, RecordBatchReader (read lazily by iter()), StructArray, and a ChunkedArray of structs (with no null rows)
  • Polars -- DataFrame
  • nanoarrow -- struct arrays and array streams
  • Other sources -- any object that exports __arrow_c_array__ (a record batch) or __arrow_c_stream__ (a stream of record batches), such as the reader from an ADBC cursor's fetch_record_batch()

Any other input, such as a plain Array, a Polars Series or LazyFrame, or a list of dicts, raises TypeError. A RecordBatchReader can be read only once; converting it again returns an empty list.

No pyarrow dependency is required at runtime. If your Arrow data comes from Polars or nanoarrow, it works without installing pyarrow.

License

Apache-2.0

Metadata

Release files for arrowmodel 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arrowmodel 1.1.0
File Size Uploaded Provenance Actions
arrowmodel-1.1.0.tar.gz 35.3 kB With provenance Details for arrowmodel-1.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for arrowmodel 1.1.0
File Actions
arrowmodel-1.1.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for arrowmodel-1.1.0-cp311-abi3-win_amd64.whl
arrowmodel-1.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for arrowmodel-1.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
arrowmodel-1.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for arrowmodel-1.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
arrowmodel-1.1.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for arrowmodel-1.1.0-cp311-abi3-macosx_11_0_arm64.whl

Total release size: 11.5 MB

Release files / arrowmodel-1.1.0.tar.gz

Download URL arrowmodel-1.1.0.tar.gz
Size 35.3 kB
Tags Source
SHA-256 checksum
How to use checksums
852756545ea668624932d97b1b84e4864bbc27166f527ea9f553e93a4856c143
BLAKE2b-256 checksum
How to use checksums
3c8e116b8442909258573753b7f7a25f712fee8d1a70205de24a207b7609038d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / arrowmodel-1.1.0-cp311-abi3-win_amd64.whl

Download URL arrowmodel-1.1.0-cp311-abi3-win_amd64.whl
Size 2.7 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
5ec43d4c3cfbbf1dcd1086fbe99e0f4c5fd3a0cc297448bbcbf956603fae2f3a
BLAKE2b-256 checksum
How to use checksums
61981622278bb07c85a4ae2c95e1d0bfa5e22aa0d7cd316389e79979dd5f59d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / arrowmodel-1.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL arrowmodel-1.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.1 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
9445967d2a6917addf8534cdee14300a27be50d15cc047bf022c86d2f3f84cec
BLAKE2b-256 checksum
How to use checksums
7785469fb0e5bb27ed352ca772749e3c8d7a6fa903171e604890fb033da11123
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / arrowmodel-1.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL arrowmodel-1.1.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 3.0 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
af7c764d3c0c265826ef67c83f400bc6b2a78a99a9b713e3c321728216a0527b
BLAKE2b-256 checksum
How to use checksums
9825d64e460f06e6d89b43ceccb7d334b3b929907b346e852a2c4e4504bc8732
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / arrowmodel-1.1.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL arrowmodel-1.1.0-cp311-abi3-macosx_11_0_arm64.whl
Size 2.6 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d2e1b1579c2779cbb15f7522e74d7debe6fdee282f0280670c86676e8609157d
BLAKE2b-256 checksum
How to use checksums
57518e1358e32a9e11508413d4f1f57747020022d23b0331640621140a065673
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for arrowmodel 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for arrowmodel-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page