-
litestar
Production-ready, Light, Flexible and Extensible ASGI API framework | Effortlessly Build Performant APIs
If I was starting from scratch with Python web API development today, I would probably look more closely at LiteStar, which seems to me to be a better architected and with a better project governance structure.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
Note 1: we are only interested in async libraries here, as FastAPI is ASGI.
-
TortoiseORM: I personally really like this Django-inspired async ORM; it's clean and nice to use.
-
Alternative ORMs: there are many such as peewee, PonyORM, etc.
-
Alternative ORMs: there are many such as peewee, PonyORM, etc.
-
SQLAlchemy Core: the core SQL query builder, without the mapping to objects part. There is also a higher level ORM built on this called databases that looks very nice. I do wonder how actively developed the project is however.
-
PyPika
PyPika is a python SQL query builder that exposes the full richness of the SQL language using a syntax that reflects the resulting query. PyPika excels at all sorts of SQL queries but is especially useful for data analysis.
PyPika: I don't know much about this one.
-
asyncpg: this was the gold standard async database driver for Postgres, being one of the first to market and most performant. While all other drivers use the C library libpq to interface with Postgres, MagicStack opted to rewrite their own custom implementation and also deviate from Python DBAPI spec. If performance is your main criteria here, then asyncpg is probably the best option.
-
psycopg3: well psycopg2 was clearly the king of the synchronous database driver world for Python/Postgres. psycopg3 (rebranded to simply psycopg) is the next, fully async, iteration of this library. This library has really come into it's own in recent years & I wish to discuss it further. See this interesting blog from the author about the early days of psycopg3.
-
Pydantic is bundled with FastAPI and is excellent for modelling, validating, and serialising API responses.
-
This is exactly the problem the creator of FastAPI tried to solve with the library SQLModel.
-
This functionality allows you to map returned database data to any Python object, including standard lib dataclasses, models from the great attrs library, and yes, Pydantic models!
-
See the full codebase here. And ⭐ if you found this useful!