skillfed

tortoise-orm

Easy async ORM for python, built with relations in mind

tortoise-orm v1.1.8 636.5K downloads/30d#5,626 on PyPI5,609
Permissive license Apache-2.0 Active released

What it is and what it does

Tortoise ORM is an async-native Object-Relational Mapper inspired by Django, designed to let developers work with relational databases using Python objects instead of raw SQL. It abstracts database interactions across SQLite, MySQL, PostgreSQL, Microsoft SQL Server, and Oracle, reducing boilerplate, preventing SQL injection through parameterized queries, and centralizing schema definitions. The package is built on asyncio and integrates with async frameworks.

You define models by inheriting from tortoise.models.Model, then initialize Tortoise to establish relationships and connect to your database. Once initialized, you can create, filter, and query records using async methods like .create(), .filter(), and .prefetch_related(). The package includes a built-in migration CLI for version-controlled schema changes, and supports complex operations like many-to-many relationships, nested prefetching, and filtering across related models.

Use it for:

  • Building async web APIs where you need to query databases without blocking the event loop.
  • Defining and managing relational schemas with version-controlled migrations in production applications.
  • Reducing SQL boilerplate in projects that work with multiple database backends (PostgreSQL, MySQL, SQLite, Oracle).
  • Implementing complex queries involving foreign keys, many-to-many relationships, and nested filtering across related models.
  • Preventing SQL injection vulnerabilities by using parameterized queries through an ORM abstraction layer.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Tortoise ORM is an async-native Object-Relational Mapper for Python that lets you define and query databases using high-level object-oriented code instead of raw SQL, with support for SQLite, MySQL, PostgreSQL, Microsoft SQL Server, and Oracle.

Yes. Tortoise ORM is actively maintained, has low install friction, carries no known vulnerabilities, and is licensed permissively under Apache-2.0. It is a solid choice for async Python projects that need to work with relational databases and want a Django-like API. Install it if you are building async applications and prefer ORM abstraction over raw SQL; skip it if you need synchronous database access or prefer a different query style.

Install

tortoise-orm on PyPI

pip

pip install tortoise-orm

uv

uv add tortoise-orm

poetry

poetry add tortoise-orm

Installing tortoise-orm

Before you install

Low friction installation with a pure-Python wheel. Active maintenance with a recent release and 5609 repository stars. Supports CPython 3.10 and later across multiple platforms.

License in practice

Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions—suitable for most projects.

Quickstart

pip install tortoise-orm

from tortoise import Tortoise, fields
from tortoise.models import Model

class User(Model):
    id = fields.IntField(primary_key=True)
    name = fields.CharField(max_length=20)

await Tortoise.init(
    db_url='sqlite://db.sqlite3',
    modules={'models': ['__main__']}
)
await Tortoise.generate_schemas()
user = await User.create(name='Alice')
print(user.name)

Requires Python 3.10 or later; database-specific drivers (aiosqlite, asyncpg, aiomysql, etc.) must be installed separately via extras (e.g., pip install tortoise-orm[asyncpg]).

Verify before relying

  • Performance characteristics and overhead compared to raw SQL or other async ORMs in production workloads.
  • Maturity of migration system and real-world experience with complex schema evolution.
  • Community size and availability of third-party extensions or integrations beyond documented frameworks.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 6 — pypika-tortoise, iso8601, aiosqlite, anyio, tomlkit, typing-extensions
Maintenance actively maintained — 4 days since the last release
Last repo commit
First released
Downloads 636,466/month — #5,626 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: tortoise_orm-1.1.8-py3-none-any.whl

Keywords: sql, mysql, postgres, psql, sqlite, aiosqlite, asyncpg, relational, database, rdbms, orm, object mapper, async, asyncio, aio, psycopg

Development Status :: 3 - AlphaFramework :: AsyncIOIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: PL/SQLProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: DatabaseTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

async orm pythonasyncio database mapperdjango-like orm asyncasync sql query builderpython async database ormtortoise ormasync relational mapper
async-firstmigrationsmulti-database

More Python Modules packages