Skip to main content

Strongly-typed DataFrames for Python, powered by Rust.

Project description

PydanTable

CI Documentation PyPI version Python versions License: MIT

Typed DataFrame workflows for Python services, with Pydantic schemas and a Rust execution core.

Why PydanTable

  • Define table shape once using Pydantic types.
  • Catch many errors early with typed expressions.
  • Use familiar DataFrame operations (select, filter, join, group_by, windows).
  • Materialize as row models or dict[str, list], depending on API needs.
  • Fit cleanly into FastAPI request/response flows.

Install

pip install pydantable

Common extras:

pip install "pydantable[polars]"  # to_polars
pip install "pydantable[arrow]"   # to_arrow / Arrow constructors
pip install "pydantable[io]"      # full file I/O convenience (arrow + polars)
pip install "pydantable[sql]"     # fetch_sql / write_sql helpers

Quick start

from pydantable import DataFrameModel

class User(DataFrameModel):
    id: int
    age: int | None

df = User({"id": [1, 2], "age": [20, None]})
result = (
    df.with_columns(age2=df.age * 2)
      .filter(df.age > 10)
      .select("id", "age2")
)

print(result.to_dict())   # {'id': [1], 'age2': [40]}
print(result.collect())   # list of Pydantic row models

Core concepts

  • DataFrameModel: SQLModel-like table class (class Orders(DataFrameModel): ...).
  • DataFrame[Schema]: generic API over your own Pydantic BaseModel.
  • Expr: typed expressions used in transforms.
  • Static typing:
    • mypy can infer schema-evolving return types for many transform chains (via the mypy plugin).
    • pyright/Pylance relies on shipped stubs; use as_model(...) / try_as_model(...) / assert_model(...) when you want an explicit after-schema model.
  • 1.2.0 column types (typing.Literal[...], ipaddress IPv4/IPv6, WKB, Annotated[str, ...]) are documented in SUPPORTED_TYPES (including Expr comparison notes).
  • Materialization:
    • collect() -> list of row models
    • to_dict() -> dict[str, list]
    • to_polars() / to_arrow() with matching extras installed

I/O at a glance

  • Lazy file pipelines: read_* / aread_* -> transform -> write_*
  • Eager reads: materialize_*, fetch_sql, fetch_*_url
  • Eager writes: export_*, write_sql
  • Full I/O API is in pydantable.io

Validation controls

  • Strict by default on constructors.
  • Optional ingest controls: trusted_mode, ignore_errors, on_validation_errors.
  • Missing optional fields are controlled by fill_missing_optional (default True).

Documentation

Development

make check-full

Contributor setup and release workflow: DEVELOPER

License

MIT

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

pydantable-1.5.0.tar.gz (211.0 kB view details)

Uploaded Source

Built Distributions

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

pydantable-1.5.0-cp313-cp313-win_arm64.whl (20.6 MB view details)

Uploaded CPython 3.13Windows ARM64

pydantable-1.5.0-cp313-cp313-macosx_11_0_arm64.whl (20.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pydantable-1.5.0-cp313-cp313-macosx_10_12_x86_64.whl (22.3 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

pydantable-1.5.0-cp312-cp312-win_amd64.whl (22.6 MB view details)

Uploaded CPython 3.12Windows x86-64

pydantable-1.5.0-cp312-cp312-musllinux_1_2_x86_64.whl (20.6 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

pydantable-1.5.0-cp312-cp312-musllinux_1_2_aarch64.whl (18.9 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ ARM64

pydantable-1.5.0-cp312-cp312-macosx_11_0_arm64.whl (20.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pydantable-1.5.0-cp312-cp312-macosx_10_12_x86_64.whl (22.3 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

pydantable-1.5.0-cp311-cp311-manylinux_2_28_aarch64.whl (21.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

pydantable-1.5.0-cp311-cp311-macosx_11_0_arm64.whl (20.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pydantable-1.5.0-cp311-cp311-macosx_10_12_x86_64.whl (22.3 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

pydantable-1.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (22.6 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file pydantable-1.5.0.tar.gz.

File metadata

  • Download URL: pydantable-1.5.0.tar.gz
  • Upload date:
  • Size: 211.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pydantable-1.5.0.tar.gz
Algorithm Hash digest
SHA256 7f8c1d1b4d367e97b8730740f4a1e54d762d7fb0055886deb795e6fd4542e59f
MD5 95f56704b97d0d4a490ef9f292b6acf2
BLAKE2b-256 5f8695fb4b11a7755586531500d1c2e53b1e967d97017b1780a965b2360ac10e

See more details on using hashes here.

File details

Details for the file pydantable-1.5.0-cp313-cp313-win_arm64.whl.

File metadata

  • Download URL: pydantable-1.5.0-cp313-cp313-win_arm64.whl
  • Upload date:
  • Size: 20.6 MB
  • Tags: CPython 3.13, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.13.11

File hashes

Hashes for pydantable-1.5.0-cp313-cp313-win_arm64.whl
Algorithm Hash digest
SHA256 85b9538541170797b1bac69cca1767da0d7099be8471cd4b6bf50c51eb20f1ed
MD5 0bc9a9d327bcee8ba52064b134cbf6dc
BLAKE2b-256 4a7033c17bc7b19500ad4a2848f721789f5e3ebbcbd640dadbbf4e7e0ffddf29

See more details on using hashes here.

File details

Details for the file pydantable-1.5.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydantable-1.5.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 117e14c5702447e9e4d8e2b2b4019cd15d908385bb876d0da8beb20585e76f3c
MD5 98117de3959afe6444b4848e020ce945
BLAKE2b-256 a9a29db2e5dba5884cb08e3156d44a22844d62485c3fdc74e9b3b71a6e1c45bd

See more details on using hashes here.

File details

Details for the file pydantable-1.5.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-1.5.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 61e9f17841d04cc06a4b088831efce94753aa03c73f6239661677b3c23b341d5
MD5 a759a894b6ec0d118fb62f3fd7d708aa
BLAKE2b-256 c2c26469ee4b87867a33114db407bb8e2660e8514dbaa57532232f61c56461e0

See more details on using hashes here.

File details

Details for the file pydantable-1.5.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pydantable-1.5.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 22.6 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.10

File hashes

Hashes for pydantable-1.5.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d330e4c9a7fe8e6ac86aa4f0312e3f7618507e9c719fd3b9b5a1a56217ee8691
MD5 7d4b8fb94132baade4d0f577d94f229c
BLAKE2b-256 a8e7c42db542cfc24b3edca48c9acb00c2ba88dce775a60bb4cf5db2a7455f7f

See more details on using hashes here.

File details

Details for the file pydantable-1.5.0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-1.5.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 6a42b7a0ec51f4406094d575e242c93534d96b14994f1eef64a11503d98d4c05
MD5 91fbd7886ebc23c12ca942f0acd33d60
BLAKE2b-256 baf7f5bd5b71dd4aad462eb955540acb30886eb9a67a3e14b160770cc9fe275f

See more details on using hashes here.

File details

Details for the file pydantable-1.5.0-cp312-cp312-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pydantable-1.5.0-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 44b120c310d0276cffbc9a5ef669816e01280655ce85a9bbde509765a6a83095
MD5 046bdec28e2d4ff9b7e2ac06354779f9
BLAKE2b-256 3e90513f40bedc95f6a9f0052c385fd05be1788481c5a100914bc850ed552868

See more details on using hashes here.

File details

Details for the file pydantable-1.5.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydantable-1.5.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 330103ff665a29a17da44386608816eef012c88c78cf76bc9d58bfa4a1581887
MD5 a11660907571324c537d7eb3b87db62a
BLAKE2b-256 eeae0b915bce9ab3ea13ae1b60d9f70759487d1b53d8bb76dd3edae389f1f8f9

See more details on using hashes here.

File details

Details for the file pydantable-1.5.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-1.5.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 19d3bb25fb0d0e3603755c4196707210713261df294112fa331623aa51eaab04
MD5 698672774ee27848317c1696f08b8a45
BLAKE2b-256 3aac95795076d609d4d337f06e6d0fcbd2e76b960ad76d7c2bc9de551802d626

See more details on using hashes here.

File details

Details for the file pydantable-1.5.0-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pydantable-1.5.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6e778c4858c433ec50a20ab5a4aa84af4bcf0123b97b9dad597cdea5ccb4df33
MD5 239b005aef4090a1c71b6e27cf107f46
BLAKE2b-256 b266bbdbc95dd4f4686f519fbc44ae35298d47a8d9aa2109a1ac730ce62a54f2

See more details on using hashes here.

File details

Details for the file pydantable-1.5.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydantable-1.5.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3e2f301920906cee96a48e4ebd19faff51a8d977706aab8d4055e1e2258ee03e
MD5 8b063d8e72479861d9deb33e3b4a475d
BLAKE2b-256 a2930be67cac736acb96ba2bba8af7fe72642b0d41300d4843a1d9830ce5682c

See more details on using hashes here.

File details

Details for the file pydantable-1.5.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-1.5.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 bf7d59e285d6b747e996a1e4144d38ee16f12d9495dfb40ac0189e44d7a7e5db
MD5 0469a6e1dbdc1f90b4c7abd6225df5e9
BLAKE2b-256 57dd7e7f6b0108d26d3b25009afd796f6f12af272725a575a3e33ce06ae6cc90

See more details on using hashes here.

File details

Details for the file pydantable-1.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydantable-1.5.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2df9fa0ff44716e0606fafb712c5651040039f5106d10acab56591902cfc8529
MD5 bb3b1509c1956d321fb97a7585d0a8c9
BLAKE2b-256 6225eed77bfec0caec8b0e8d9602d4cebe2a7ba16a0b1fac6596ded2f6269375

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