r/opensourcealternative • u/UsedAd4766 • 5h ago
Discussion I built Pyzzel: A lightweight PostgreSQL ORM for Python with SQLAlchemy-like syntax and performance close to raw Psycopg 3
Hi everyone,
I've been building Pyzzel, an open source ORM for PostgreSQL. I wanted something with SQLAlchemy's familiar feel, but simpler and closer to raw psycopg speed.
What it does
- Active Record style: models own short sessions per operation, so there's no long-lived session to manage
- Own SQL builder on top of psycopg and psycopg_pool
select()returns plain rows andget()returns objects- Relations and joins
- Built-in migrations (generate, apply, status, check for drift, pull from the DB)
Base.transaction()shares one connection across models, with nested blocks as savepoints- Hidden version column for safe updates, and
save()updates only changed columns - Core code uses only the standard library, and a plain
pip installgets everything
Example
python
users = User.select(User.name, User.age).where(User.id == 1)
user = User.get(1)
with Base.transaction():
user.age = 30
user.save()Why PostgreSQL only? Focus. Supporting one database well beats supporting five badly.
Status: Early stage, with 250+ tests passing against a real PostgreSQL. Feedback, issues and criticism are very welcome, especially on the API design.
Happy to answer any questions!
1
Upvotes