r/PythonLearning • u/UsedAd4766 • 1d ago
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 and get() 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 install gets 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.
GitHub: https://github.com/himanshubokde21/Pyzzel
PyPI: https://pypi.org/project/Pyzzel/
Happy to answer any questions!
1
u/riklaunim 1d ago
Curious what that raw psycopg speed you are talking? Outside your localhost database with few records will be heavily database-bound and not limited by whatever Python wrapper is used.
2
u/Interesting-Cat3788 1d ago
Since its entirely vibe coded, could you atleast shed some light on the motivation behind this ?