ORM in Python

8 projects in Database & Storage. Most starred: sqlmodel, sqlalchemy and peewee.

SQLAlchemy is the most capable Python ORM and has two layers: Core, a SQL expression language, and the ORM, with a unit of work and identity map on top. It supports many databases, has an asyncio extension, and pairs with Alembic for migrations. The Django ORM is tied to Django but is the simplest path inside it, with models, querysets and migrations built in. Peewee is a small, expressive ORM for projects that want less machinery. SQLModel, by the author of FastAPI, combines SQLAlchemy and Pydantic so that one class can be both a table model and an API schema.

For document and key-value stores, MongoEngine is a synchronous object-document mapper for MongoDB, while Beanie is async and built on Pydantic models, which suits FastAPI projects. django-mongodb-backend is MongoDB's official backend for using MongoDB through the Django ORM, and PynamoDB gives Amazon DynamoDB tables a model-based Python interface. Document mappers add structure to schemaless stores, but they cannot make a document database behave like a relational one, so model your data around the queries you need rather than translating relational tables one to one.

Deeper lists: awesome-sqlalchemy

Relational Databases4

sqlalchemy

The Python SQL Toolkit and Object Relational Mapper.

12.3kupdated 1d agorel_2_1_6

peewee

A small, expressive ORM.

12kupdated 3d ago4.5.3

sqlmodel

SQLModel is based on Python type annotations, and powered by Pydantic and SQLAlchemy.

18.5kupdated 9d ago0.0.48

NoSQL Databases4

pynamodb

A Pythonic interface for Amazon DynamoDB.

2.6kupdated 4mo ago6.1.0

mongoengine

A Python Object-Document-Mapper for working with MongoDB.

4.3kupdated 1mo ago0.29.3

beanie

An asynchronous Python object-document mapper (ODM) for MongoDB.

2.7kupdated 5d ago2.2.0

django-mongodb-backend

Official MongoDB database backend for Django.

229updated 3d ago6.1.0
Esc

Type to search every entry. ↑↓ to move, Enter to open.