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.
  • 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.1.0.tar.gz (190.5 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.1.0-cp313-cp313-win_arm64.whl (20.3 MB view details)

Uploaded CPython 3.13Windows ARM64

pydantable-1.1.0-cp313-cp313-macosx_11_0_arm64.whl (20.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pydantable-1.1.0-cp313-cp313-macosx_10_12_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

pydantable-1.1.0-cp312-cp312-win_amd64.whl (22.2 MB view details)

Uploaded CPython 3.12Windows x86-64

pydantable-1.1.0-cp312-cp312-musllinux_1_2_x86_64.whl (20.3 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

pydantable-1.1.0-cp312-cp312-musllinux_1_2_aarch64.whl (18.6 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ ARM64

pydantable-1.1.0-cp312-cp312-macosx_11_0_arm64.whl (20.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pydantable-1.1.0-cp312-cp312-macosx_10_12_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

pydantable-1.1.0-cp311-cp311-manylinux_2_28_aarch64.whl (21.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

pydantable-1.1.0-cp311-cp311-macosx_11_0_arm64.whl (20.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pydantable-1.1.0-cp311-cp311-macosx_10_12_x86_64.whl (21.9 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

pydantable-1.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (22.2 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pydantable-1.1.0.tar.gz
Algorithm Hash digest
SHA256 29d524af4bdbc79981506de3958378f80e39577f1b00fbb5b6f5a966ae69a5e5
MD5 3117c43f68963c7f446e3c0e1e82da16
BLAKE2b-256 1f96c370db8b1751d6c2cfffcffd4dbc97d24cb6d74a9b5add87eb362a9c93e5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydantable-1.1.0-cp313-cp313-win_arm64.whl
  • Upload date:
  • Size: 20.3 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.1.0-cp313-cp313-win_arm64.whl
Algorithm Hash digest
SHA256 9ea074a01e038d31e7f4f5f191c8ac7dfe3c894fbe6af411cf30f2c5eb5859c8
MD5 f58a0f029965482c699545bf6800cc15
BLAKE2b-256 da360644d205539ad85db2267970d995951e02d38f59ab1057ca0feb7e598fb6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f6a2f16bd4982dbc8b5329547f48747cff2b733887fb062370c8190ce0f04fe
MD5 df85799ff6c6602e45a769f200fd0f7c
BLAKE2b-256 a45b029a0145d80981c82efa0d1870e444f7e0a6abe534ead6a1df2614f240c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.1.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 bb9426958d06fb38fb729c677240403a0a47cdb1e52e64c5e88e1bacee6ffd2b
MD5 a524d497eeb2d0f27f610b34fe0120a0
BLAKE2b-256 733d5fb5ddd7f57b62d1e0fa163d7c102d1e0bd16d579b166a5e3f91f000da4b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydantable-1.1.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 22.2 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.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0f5670e9f88667b0a8119b556ef6825b35f891ab6f9c9ec77793940517f81c6c
MD5 39a601f6ee3319289a410527b7a1fa97
BLAKE2b-256 3469b32bd2dcaca275839cc9e11e5f7aa672a9368c2405d5dbbd8e6ba1b5177a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.1.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 92e5083f4d5128ef8e2040858fa7c8c30c5a773170c77012ddcf1311385f59e8
MD5 225f5ac26a8cc5f3a9ac32b2d263beb7
BLAKE2b-256 cf1ae17444d88eb08ffc2302f92e299c42bc38a26d5f37e1405921aa2e8a15d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.1.0-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 5e87262dce261ec9280f7bcb1126dc17b8bd655c72f7b75f9bf734b603620b08
MD5 89435ecd7e672baf8b989c7b63d7edfb
BLAKE2b-256 121bc98f66647d1236be81de7db7c171877867f4f0c49c8bfb3910be32e72f83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f7115b74a114e86189e8cb3997ea5cf3a3596d6c6fc5c4ce35d29f0db5228328
MD5 7edd6c345c09d88c3a8f95a7f0ae98fc
BLAKE2b-256 8ebbfa269089cad687e0dbc2351a3874b6f48d7c0cc006d4395c271f710df2b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.1.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9df6618c1e486c490e3719345362b654e849c472e109e130acd9d15f976512dc
MD5 2697145748b2de024accd9fa9e31f1e3
BLAKE2b-256 33dabc466ebf4db0acdc5847e957f25f048f48a459d9bc718a2b247bc394f983

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.1.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d11856f33ff915089ae2eee0a91a7563793f351029435893dd93f5a1a790a509
MD5 521f44e5b95c4e667d0dcc8cd2d5ea89
BLAKE2b-256 e4ef6159d0cd897177d8f015cdcf6d1767c94ca953d40d684dbe295f75b65670

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3204cf08ef2dd42411ca3abe45e18e96177d05d71ef052f706f9cd74a9fedc9c
MD5 ddf5691083dad1065277a2a30e72a6b8
BLAKE2b-256 9fc167c563a6d1bb2e0951e2d4ac8887bfbb3311d094425d332a295aec20394b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.1.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 069f64e68b431b28d2109664a7b4495c2e94cc1d4965c4457dca9e55d558ed55
MD5 8439e179f023f4075442bc1b567a3285
BLAKE2b-256 9b42fda4de1a779905e3af5991f4a1d80d7532d2ba1935a9950cabc381cffd33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 56116876f9f2fc7f87d1457d6136d170965803a930825d51e1c68c6d0defc9c4
MD5 6f8015756502b009598c462a0d4b2270
BLAKE2b-256 135e5838900af6ae905c5d4236d343917868cb8ffd9fa706b77bd1502687fd68

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