Rust-backed async ORM for Python applications that already use Pydantic models as their data boundary.
Project description
A Rust-backed async ORM for Python applications that use Pydantic models.
Ormdantic lets you declare database tables with Pydantic v2 models and run async CRUD, relationship loading, migrations, reflection, and native SQL execution through a Rust-backed runtime.
The project is designed for applications that want Python model ergonomics without giving up SQL database features. Python owns the model and API surface; Rust owns SQL compilation, type conversion, and driver execution.
What you get
| Area | What Ormdantic Provides |
|---|---|
| Models | Pydantic models decorated as database tables. |
| CRUD | Async insert, update, upsert, delete, find, count, and bulk update helpers. |
| Queries | Dictionary filters for ordinary cases and expression objects for advanced SQL. |
| Relationships | Explicit joined and select-in loaders, plus explicit relationship loading. |
| Transactions | Async transaction and session contexts. |
| Migrations | Snapshots, diffs, plans, migration artifacts, history, rollback, repair, and squash helpers. |
| Reflection | Live database inspection for tables, columns, indexes, constraints, schemas, views, sequences, and dialect metadata. |
| Drivers | SQLite, PostgreSQL, MySQL, MariaDB, SQL Server, and Oracle through the native runtime. |
Benchmarks
The reproducible benchmark report in benchmark/ compares Ormdantic,
SQLAlchemy, and SQLModel on local SQLite file databases. It includes read and
write cases, and the optional huge profile uses million-row datasets.
Million-row profile:
Install
uv add ormdantic
First example
from pydantic import BaseModel, Field
from ormdantic import Ormdantic
db = Ormdantic("sqlite:///app.sqlite3")
@db.table(pk="id", indexed=["name"])
class Flavor(BaseModel):
id: str
name: str = Field(min_length=2, max_length=63)
rating: int = 0
async def main() -> None:
await db.init()
await db[Flavor].insert(Flavor(id="vanilla", name="Vanilla", rating=5))
result = await db[Flavor].find_many(
{"rating": {"gte": 4}},
order_by=["name"],
)
for flavor in result.data:
print(flavor.name)
Learn the project
Start with the documentation when you are new:
docs/learning-path.mdtells new and advanced readers where to start.docs/quickstart.mdwalks through the first model, first table, first query, first session, and first migration preview.docs/concepts/explains tables, fields, relationships, querying, loading, sessions, migrations, events, and the native engine.docs/drivers/explains SQLite, PostgreSQL, MySQL, MariaDB, SQL Server, and Oracle behavior.docs/examples/contains task-focused how-to guides.docs/api/documents the Python API with generated references and usage notes.
Migration CLI
Migration commands can read the database URL from --url, an exported
DATABASE_URL, or a local .env file:
export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres"
uv run ormdantic migrations init
uv run ormdantic migrations apply-dir migrations
uv run ormdantic migrations current
The CLI prints redacted connection details and summaries such as
Applied 2 migrations from migrations. instead of only raw revision IDs.
Development
Common commands:
bash scripts/lint.sh
bash scripts/test.sh
bash scripts/docs_build.sh
The docs use Zensical:
uv run --group docs zensical build
uv run --group docs zensical serve
Rust crates live under rust/crates/ and are managed from the repository root Cargo.toml.
Status
Ormdantic is evolving quickly. Prefer explicit migrations, review generated SQL before applying it in production, and check the driver-specific pages for dialect behavior.
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 ormdantic-2.0.1.tar.gz.
File metadata
- Download URL: ormdantic-2.0.1.tar.gz
- Upload date:
- Size: 353.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4e4393e8c35f2d155b0175a50bd103a68fffef3c16b0fe9600ece4229d6a101
|
|
| MD5 |
a2ba0752e184a8a40729d8318caac70f
|
|
| BLAKE2b-256 |
1d53245bb2c54b55cd2107a364232c2e9db7bf98c48aeaf1d93419fea5f96c3a
|
File details
Details for the file ormdantic-2.0.1-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f22395870b80b3c32cc16db60d6c003625b1de455cd10004fa8a122262739b18
|
|
| MD5 |
77db3f598570843a84dde92fc6fcc5e9
|
|
| BLAKE2b-256 |
c78be6c537765ce2cfcf149614ee40220181bdfe677bedb4cde319e507b954bc
|
File details
Details for the file ormdantic-2.0.1-cp314-cp314-manylinux_2_38_x86_64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp314-cp314-manylinux_2_38_x86_64.whl
- Upload date:
- Size: 5.8 MB
- Tags: CPython 3.14, manylinux: glibc 2.38+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d95615fd8eb275071dd21b8de0573ddf592fb7c90c60f701ad38e0dc9ceb1b85
|
|
| MD5 |
111c7805f15314b9b6d45fc705d954a7
|
|
| BLAKE2b-256 |
5a71490960c99d16b42f4d270f218ea3fbe19a6406873baa747b5d7d07c63b79
|
File details
Details for the file ormdantic-2.0.1-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c43f7d8e8b85f2e5d68b4d8ea6a766fb9d92d01b41140d673f09ea95a5354f46
|
|
| MD5 |
5af96744f954c8f9cbd25601bba56185
|
|
| BLAKE2b-256 |
b289b48ac034aea7d200641d47a0199c82951f5419887ec69bc94767895bc55d
|
File details
Details for the file ormdantic-2.0.1-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
885ddff60ab9cc5f4a43f3f07ad9ce87b1075f8ae261eea98f0ed96acd387a84
|
|
| MD5 |
37c71807b266602e6e258764355ee096
|
|
| BLAKE2b-256 |
92b662134382cccceaf7d3eefe10ba1e1a55007d700622bc0fcfacecdd7bd43b
|
File details
Details for the file ormdantic-2.0.1-cp313-cp313-manylinux_2_38_x86_64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp313-cp313-manylinux_2_38_x86_64.whl
- Upload date:
- Size: 5.8 MB
- Tags: CPython 3.13, manylinux: glibc 2.38+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
722a7d90e8937e13783410947ff4a4c84d5a60cb858fee9935750ae442a3b431
|
|
| MD5 |
6212906de4ca55d64858d112806a6ac6
|
|
| BLAKE2b-256 |
96651fe78c1ff0228d0a2a7eaf7d26cf950e9d2ddd5b07c98a9e17351b9f0af9
|
File details
Details for the file ormdantic-2.0.1-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6068475361da07735a198d7b04494cd5cdc7347f7b3cba3c95de024d9e849cb
|
|
| MD5 |
6652b094852a21c0f468dcc58f22d18e
|
|
| BLAKE2b-256 |
5188613fd45020b0a3923e8bd0eece9eb18950c360fa883f2f2fc6b4b381034f
|
File details
Details for the file ormdantic-2.0.1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce0e4d8e09c75552ff0c6588ca5cd33ca2c226fcd874da0dc0fb1aa2b9ae9127
|
|
| MD5 |
6275f79cfb15dc3bb3c485ca57e6a52f
|
|
| BLAKE2b-256 |
e1ac47262126e4cfd7ef3f1649f59494bda4c5404c0af0d514c3bf1d378c1807
|
File details
Details for the file ormdantic-2.0.1-cp312-cp312-manylinux_2_38_x86_64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp312-cp312-manylinux_2_38_x86_64.whl
- Upload date:
- Size: 5.8 MB
- Tags: CPython 3.12, manylinux: glibc 2.38+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
042c1ee27f750ac6fbd113948780273080a71c430ed62fc65a77775babb5e3e4
|
|
| MD5 |
e2669d704b85b3898c691557dfb2279b
|
|
| BLAKE2b-256 |
0378215532b65f275558024bef335f22b4a9d267bfc90fcc13475d359f700b65
|
File details
Details for the file ormdantic-2.0.1-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8d528f6c965082dce4214e0b9d54464a4b7a6af6b81ecc35dd79641f6ab4c11
|
|
| MD5 |
ec77e006ebcfb8fb2d98baac2432f961
|
|
| BLAKE2b-256 |
c0822b9a7f54aa2f33a610feb7022c75ef18d5fcbd1e05e18412077cedf9ed92
|
File details
Details for the file ormdantic-2.0.1-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ba2d62b872ae452c974dcdf7836731b9f04c26a11b77328b1c93694b072aa1e
|
|
| MD5 |
08a807bf0328d966474a77d8084174ab
|
|
| BLAKE2b-256 |
a3db8616802e2550e9ea301ccfa183e75db1af52139c9674e71a3d74c2dbfa96
|
File details
Details for the file ormdantic-2.0.1-cp311-cp311-manylinux_2_38_x86_64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp311-cp311-manylinux_2_38_x86_64.whl
- Upload date:
- Size: 5.8 MB
- Tags: CPython 3.11, manylinux: glibc 2.38+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88a7c9b939bf3428925767412d0ae9ccbdf0cd20ef7799df8d5f1b77e65c7444
|
|
| MD5 |
3e75c8d3e0e17740bdfbbdf87fc4255d
|
|
| BLAKE2b-256 |
fc012ac9be5c0463eb9fe4af975e8a2ab2b1655a29399ecc2052727a62f722b1
|
File details
Details for the file ormdantic-2.0.1-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cf7ddfb5a9de14cc8fd9ae12d0946ece4b1723cc0c8d2738de4eff2e1459ecb
|
|
| MD5 |
1cfbe01a1486635d6084a4062ff7081e
|
|
| BLAKE2b-256 |
b178c074d5cce9332cd3ea43eb01410b44e58b70b5eeca0e81797f5df72efd32
|
File details
Details for the file ormdantic-2.0.1-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ba8e735fd66d57063c76224e0c1697913633473d31b834bf7d2536eb2aaab4e
|
|
| MD5 |
d7c65df8d9f1a894ec9549ecb847d116
|
|
| BLAKE2b-256 |
becc996eab852e712d07a6825578e1c8e43408328d6e00afa2f59e321bb2d378
|
File details
Details for the file ormdantic-2.0.1-cp310-cp310-manylinux_2_38_x86_64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp310-cp310-manylinux_2_38_x86_64.whl
- Upload date:
- Size: 5.8 MB
- Tags: CPython 3.10, manylinux: glibc 2.38+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74c06d370c417e99c57cb44eda09213a39d29daa988cae83a3b90e990eeee8db
|
|
| MD5 |
70b7de159c7185fcc1a3b37795e6ca19
|
|
| BLAKE2b-256 |
a18a672551e69527dbeba871eee633c83fb7e795209050650f129bd7c9c80013
|
File details
Details for the file ormdantic-2.0.1-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: ormdantic-2.0.1-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce28cb9e41e2b7020406df488892f5e6cb466de3ad5dfdfa8653fd81595b4a4a
|
|
| MD5 |
8b54663fe8d806f0edd310b1973c0872
|
|
| BLAKE2b-256 |
e32800ed0c8f6dd98bfc7923779e53ae2969fcac08ba5829cb603b7a5931d40a
|