A Python library for Apache Arrow
Project description
arrowmodel
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(**row) two-step with a single call that is roughly 2x faster for flat schemas.
Quick Start
Installation
pip install arrowmodel
No Rust toolchain needed -- pre-built wheels are provided.
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: Arrow buffers go straight to
model_constructcalls in Rust -- noto_pylist(), no intermediate dicts. - ~2x faster for flat schemas: Roughly twice the throughput of the pure-Python approach, with less allocation pressure.
- Three API styles:
ArrowModelbase class for concise models,ArrowModelConverterfor reusable converters, andmodel_convert/model_iterfor one-shot use. - Validated mode: Pass
validate=Trueto run full Pydantic validation (model_validate_json) when you need type coercion or custom validators. - Pydantic alias support: Resolves
validation_alias,alias, field name, andpopulate_by_name/validate_by_name. - Nested models: Arrow
Structcolumns map to nested Pydantic models, including optional structs and deeply nested hierarchies. - Lazy iteration:
iter()yields one model at a time, materialising oneRecordBatchworth of instances 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-PyCapsule-compatible input via the Arrow C Data Interface:
- pyarrow --
RecordBatch,Table - Polars --
DataFrame(exports via PyCapsule) - nanoarrow -- arrays and record batches
No pyarrow dependency is required at runtime. If your Arrow data comes from Polars or nanoarrow, it works without installing pyarrow.
License
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 Distributions
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 arrowmodel-1.0.0.tar.gz.
File metadata
- Download URL: arrowmodel-1.0.0.tar.gz
- Upload date:
- Size: 29.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b1cb9a7d319fc70ba14f00b88851d12a1be16589e62c9d7ef45be8aadcb69fc
|
|
| MD5 |
420edd0d16d30f1e612f68811ca49ad6
|
|
| BLAKE2b-256 |
e0fea8e05b5171b50f5d81386ef42109dfecd26bb75fac33b8c5d98c1fe03c1c
|
Provenance
The following attestation bundles were made for arrowmodel-1.0.0.tar.gz:
Publisher:
release.yml on anentropic/arrowmodel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arrowmodel-1.0.0.tar.gz -
Subject digest:
8b1cb9a7d319fc70ba14f00b88851d12a1be16589e62c9d7ef45be8aadcb69fc - Sigstore transparency entry: 2103638016
- Sigstore integration time:
-
Permalink:
anentropic/arrowmodel@7fa0e808f378dedde075cfaeedd49ec32248a05f -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/anentropic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7fa0e808f378dedde075cfaeedd49ec32248a05f -
Trigger Event:
push
-
Statement type:
File details
Details for the file arrowmodel-1.0.0-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: arrowmodel-1.0.0-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6903dc17a2b30b6c97631580c9b255953dc40f7f6d7fc88c16e07e874980ed51
|
|
| MD5 |
e5c9c85a3b78d04db1c7247786edea8e
|
|
| BLAKE2b-256 |
25209e6bd7485f07d3095727c1eced1c216157a3dd591d8e25e1ac6bfd0d6fa6
|
Provenance
The following attestation bundles were made for arrowmodel-1.0.0-cp311-abi3-win_amd64.whl:
Publisher:
release.yml on anentropic/arrowmodel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arrowmodel-1.0.0-cp311-abi3-win_amd64.whl -
Subject digest:
6903dc17a2b30b6c97631580c9b255953dc40f7f6d7fc88c16e07e874980ed51 - Sigstore transparency entry: 2102369895
- Sigstore integration time:
-
Permalink:
anentropic/arrowmodel@2dd065b1cb2b6b80f05b603965bb0a3cb2ddeb21 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/anentropic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2dd065b1cb2b6b80f05b603965bb0a3cb2ddeb21 -
Trigger Event:
push
-
Statement type:
File details
Details for the file arrowmodel-1.0.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: arrowmodel-1.0.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47c482283f07b52fb7bbf80526650e2f8bebb776c961b4754e5ecc51353c3351
|
|
| MD5 |
d9bb61acdda0075afeb0182ab08f20af
|
|
| BLAKE2b-256 |
5fe693ebd343deb3e52eb0281875d07745c10a9c85d61dab481559e68e6b3fb2
|
Provenance
The following attestation bundles were made for arrowmodel-1.0.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on anentropic/arrowmodel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arrowmodel-1.0.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
47c482283f07b52fb7bbf80526650e2f8bebb776c961b4754e5ecc51353c3351 - Sigstore transparency entry: 2102370721
- Sigstore integration time:
-
Permalink:
anentropic/arrowmodel@2dd065b1cb2b6b80f05b603965bb0a3cb2ddeb21 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/anentropic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2dd065b1cb2b6b80f05b603965bb0a3cb2ddeb21 -
Trigger Event:
push
-
Statement type:
File details
Details for the file arrowmodel-1.0.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: arrowmodel-1.0.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a86b4fac72ff72e6209b42d35cec933841389e7810014f0071c2d8a936769d7
|
|
| MD5 |
d940cb090eab1f40640d9d2af307ec21
|
|
| BLAKE2b-256 |
a283b926c06157c2cfcf802626a8cd6690cb2b2c886b749bf303a6388caf5a54
|
Provenance
The following attestation bundles were made for arrowmodel-1.0.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on anentropic/arrowmodel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arrowmodel-1.0.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
6a86b4fac72ff72e6209b42d35cec933841389e7810014f0071c2d8a936769d7 - Sigstore transparency entry: 2102370938
- Sigstore integration time:
-
Permalink:
anentropic/arrowmodel@2dd065b1cb2b6b80f05b603965bb0a3cb2ddeb21 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/anentropic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2dd065b1cb2b6b80f05b603965bb0a3cb2ddeb21 -
Trigger Event:
push
-
Statement type:
File details
Details for the file arrowmodel-1.0.0-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: arrowmodel-1.0.0-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c545b52a4b701537f3a3d3aaa72e01898d22a752440747a83433a827a2ed7131
|
|
| MD5 |
5bffdc3bf105aca488e326d09fe67cdf
|
|
| BLAKE2b-256 |
2ad26e7947fbedf1023aab67afdeb7e5fdb086aed04cff54b0429bf6b6100536
|
Provenance
The following attestation bundles were made for arrowmodel-1.0.0-cp311-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on anentropic/arrowmodel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arrowmodel-1.0.0-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
c545b52a4b701537f3a3d3aaa72e01898d22a752440747a83433a827a2ed7131 - Sigstore transparency entry: 2102370186
- Sigstore integration time:
-
Permalink:
anentropic/arrowmodel@2dd065b1cb2b6b80f05b603965bb0a3cb2ddeb21 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/anentropic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2dd065b1cb2b6b80f05b603965bb0a3cb2ddeb21 -
Trigger Event:
push
-
Statement type:
File details
Details for the file arrowmodel-1.0.0-cp311-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: arrowmodel-1.0.0-cp311-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.11+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f640d629e26c01a867817c4d7bab455225767c626b509880cfe95bbe1b633138
|
|
| MD5 |
09dd162e3422b9f2b781a39c98e276c7
|
|
| BLAKE2b-256 |
69abe0983bb4f627b0f9a761f16e025ba64dea2c1d3bf553677a6005ac572f6f
|
Provenance
The following attestation bundles were made for arrowmodel-1.0.0-cp311-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on anentropic/arrowmodel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
arrowmodel-1.0.0-cp311-abi3-macosx_10_12_x86_64.whl -
Subject digest:
f640d629e26c01a867817c4d7bab455225767c626b509880cfe95bbe1b633138 - Sigstore transparency entry: 2102371347
- Sigstore integration time:
-
Permalink:
anentropic/arrowmodel@2dd065b1cb2b6b80f05b603965bb0a3cb2ddeb21 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/anentropic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2dd065b1cb2b6b80f05b603965bb0a3cb2ddeb21 -
Trigger Event:
push
-
Statement type: