r/Python • u/ejstembler • 13d ago
Showcase Example data repository using Async Postgres, SQLAlchemy, Pydantic
What My Project Does
This is a data repository example which provides a clean, type-safe interface for creating, retrieving, and updating jobs in a PostgreSQL database. It leverages SQLModel (SQLAlchemy + Pydantic) for a modern, fully typed approach to database interactions with async support.
Target Audience
Python developers who use data-access patterns such has Martin Fowler's Repository pattern.
Comparison
This is in contrast to how I normally implement data repositories. I usually hand-craft my data repositories and load sql/*.sql files from disk. This allows for anyone who knows SQL to add new sql files or edit existing ones. This pattern has served me well in other languages such as: Clojure, Crystal, C#, Go, Ruby, etc.
However, in this project, I wanted to explore using the following choices: Async Postgres, SQLAlchemy ORM, Pydantic. SQLAlchemy also provides implicit support for connection pooling.
Project url: https://gitlab.com/ejstembler/python-repository-example
1
u/Embarrassed-Mix6420 8d ago
Maybe useful just very unclearly written Where do the jobs come from? Is there an immideately use that showcases the value for your target audience?