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.4.0.tar.gz (205.4 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.4.0-cp313-cp313-win_arm64.whl (20.6 MB view details)

Uploaded CPython 3.13Windows ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.12+ x86-64

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

Uploaded CPython 3.12Windows x86-64

pydantable-1.4.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.4.0-cp312-cp312-musllinux_1_2_aarch64.whl (18.9 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 10.12+ x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 10.12+ x86-64

pydantable-1.4.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.4.0.tar.gz.

File metadata

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

File hashes

Hashes for pydantable-1.4.0.tar.gz
Algorithm Hash digest
SHA256 e91a24462db4509c8b36e75a4706fc18dd66f8a94057486e819f03739d8dc4bf
MD5 875788b1fab3b6a7baf0331fed9b0e99
BLAKE2b-256 1762700b65de59c1fb9548d69b585d14a0877f7b254175e1a111f8e05e8a43c5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydantable-1.4.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.4.0-cp313-cp313-win_arm64.whl
Algorithm Hash digest
SHA256 eee99886f1a814cdd836517831b4135963700b4175173a8cc33a031088efca15
MD5 48530f88fd620cecd2cb006e28348612
BLAKE2b-256 32a3ce65a01d1788167833e9da3dc6078c23ec10b0677172eccd5cfc1a7360e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.4.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 add4a6854dd1cd5f7e02c97638a2c9dde76616d82e1ce0a760add2590b913b33
MD5 0febbb27201f15cc77bcb01c97298ee7
BLAKE2b-256 388597eea1e6044e38984c02c2d2b1d03d2738130cbea427c6793a8365952cdc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.4.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1c1bbbc3fc3963e600d87bb3aaaf32c2c9582a2685bb6610489fb21fc3e34bad
MD5 dc2162a9b82878166f06ddc425ed509b
BLAKE2b-256 14849fd555f933129be4284b62ade497d003eeaabe5b7c274a32802233e3411c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydantable-1.4.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.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cc44efdad2bc511c2b1c9d2aa835830287aa9f8237db196ed7c7c4ff136f0963
MD5 175efabf2b65b79a84c60255ebd8e863
BLAKE2b-256 e95a34f7c07708ef73f7f53b1757d13cf40fcac02b6a2fb8fa8f1bf4773ec233

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.4.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ed920c708fabb43af78c92a7c15ba3e5bb932ad5c153e7240e4ea2465af1a0ba
MD5 dd56f647d135b4a9f955ca4782cd15cb
BLAKE2b-256 e98b8b3c6ea5c5596a899b0e3217bfe530dacb8ca89f380e006be071a52427f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.4.0-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 4d0e01422df08b0b8e1466fdaf56b333093b635c1ef4448e4e4ee8adee7baca1
MD5 705fdc59c5e11b1e6fde7c983d6cd8ca
BLAKE2b-256 03d87b2cba293e114033e7c91182ca379fb1e9b57ee8d150bd5497d74d69fa4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.4.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2895daa7af85c685a8cf603d558a4d18f29cf7ad9b4d5efcb82cb6d85f5465b3
MD5 0d9f00f5e8b7b74cf25e9dff3d9a5238
BLAKE2b-256 41ada85a7fc9a21e537de546b5cafc31f9ad8347126a2afc82645cea97d4ca9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.4.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8448b15d7885c27355c74adf9e9ed15bf8963f684fe563c08e59e30a5ee7daac
MD5 20e23eb67fdbbb122b1003397912f6cd
BLAKE2b-256 bd0a860031c7b7990ac24a5fccd083d03ac48dd54f4f77978c2d8a5c0224d3bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.4.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c72bccbc7b85006a48677d417865e571fafdd8c22cb7631cff6248f243869b08
MD5 28e697b5bcb3bb75758fe376a698b99d
BLAKE2b-256 73f2ff89c68519be7b4b8f80b14c5766579954d316299e6936afcb4514fe0ee0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.4.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49f3f281314d949b7f28a2bc905a80c5506cbe63c6076bc480eb48996b9e518a
MD5 580da1aa03a2ff9660f3970d8d44dcf5
BLAKE2b-256 328a3491dad60ecd68fd9433565b260098d89fce40e73891c13131a17091a4e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.4.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fdcdb48b7f68b511c371d992f04f7d1225339c941ada229a9108cc50ee6baad9
MD5 ccb903909695716e07bbd3f7dfbf9b48
BLAKE2b-256 b13dfe74c68d8af79c7c5bb63e7e86f264af2d5dcaf6092223622d3dfa572e6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantable-1.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8048f74da70e3b1cf7f583d3e403d501a0b0370925a6af7ab7105c9014ea9a40
MD5 ebe68dfa80ceda47bc6d46965ceb41c3
BLAKE2b-256 104d4499b6a6664b09c241b7f620806acc80c741c7e6142816d6e1d67550c8a6

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