Skip to main content

mizzle

Fully typed async ORM for Python and PostgreSQL

GitHub • PyPI • Example app • Releases


What's mizzle?

mizzle is an ORM for people who like SQL. You describe tables as Python classes and write queries that read like the SQL they produce. Every row comes back typed, so your editor and type checker know user.email is a str — no code generation, no plugins.

It is async from the ground up, built on asyncpg, with one runtime dependency. Values are always sent as bind parameters, update and delete refuse to touch a whole table by accident, and database errors never leak your data into logs.

Need nested data? Relational queries load a user with their posts and comments in a single SQL statement, typed all the way down.

Ecosystem

mizzle CLI generates SQL migrations from your schema, applies them safely (even with many app servers starting at once), pushes changes straight to a dev database, and pulls an existing database into Python code.

mizzle studio opens your database in the browser to browse, filter and edit data.

Quick look

pip install mizzle
mizzle init        # creates mizzle.toml, db/schema.py and migrations/
from typing import final

from mizzle import Database, Table, eq, sql
from mizzle.pg import serial, text, timestamp, varchar


@final
class Users(Table, name="users"):
    id = serial().primary_key()
    email = varchar(255).not_null().unique()
    bio = text()
    created_at = timestamp(tz=True).not_null().default(sql("now()"))


async with await Database.connect("postgresql://...", schema=[Users]) as db:
    [ann] = await db.insert(Users).values(email="ann@example.com").returning()
    users = await db.select().from_(Users).where(eq(Users.id, ann.id))  # list[Users]
mizzle generate    # write a migration from your schema
mizzle migrate     # apply it
mizzle studio      # browse the data

In production

db = await Database.connect(
    "postgresql://...",
    schema=[Users],
    replicas=["postgresql://replica-1/...", "postgresql://replica-2/..."],
    pool_size=20,
    query_timeout=5,  # seconds; slow queries raise QueryTimeout
)

await db.select().from_(Users)  # reads go to the replicas, in turn
await db.primary.select().from_(Users)  # read your own write right away
await db.retry(transfer)  # re-run a transaction on a serialization conflict

Writes, transactions and FOR UPDATE always use the primary. Behind PgBouncer in transaction mode, pass statement_cache_size=0. CI tests a real streaming replica and PgBouncer on every change.

What else is in the box

Joins, subqueries, CTEs, window functions, UNION, CASE and typed SQL functions; identity, generated and auto-updated columns; pgvector and full-text search; views, row-level security, roles, functions and triggers in migrations; streaming, COPY, LISTEN/NOTIFY; read replicas, timeouts and retries. See the changelog for examples.

Learn more

The example app is a complete FastAPI service built with mizzle: schema, migrations, relational queries, Pydantic models, seed data and tests. Full documentation is on the way.

License

MIT

Metadata

Release files for mizzle 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mizzle 0.2.2
File Size Uploaded Provenance Actions
mizzle-0.2.2.tar.gz 765.5 kB With provenance Details for mizzle-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mizzle 0.2.2
File Interpreter ABI Platform Actions
mizzle-0.2.2-py3-none-any.whl Python 3 none any Details for mizzle-0.2.2-py3-none-any.whl

Total release size: 933.3 kB

Release files / mizzle-0.2.2.tar.gz

Download URL mizzle-0.2.2.tar.gz
Size 765.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f40e0b4a5635232a22561549f70ce5bb0626fe98feb4476228b00d248a936530
BLAKE2b-256 checksum
How to use checksums
cb732f39b5e38768a05c73a6519bccec6078b4fb77297722c639a053f32e8a79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / mizzle-0.2.2-py3-none-any.whl

Download URL mizzle-0.2.2-py3-none-any.whl
Size 167.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f77af008c3e926a0849a37b0fc1bfac6ce771c719faa2cb4ccbf3e2f6f4a446
BLAKE2b-256 checksum
How to use checksums
1da35f5f66acaec95f8d94eafe0adc9d5802a20f1f202c59a764e8b63f39813f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for mizzle 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mizzle-0.2.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page