--- id: tortoise-orm version: "1.1.8" license: Apache-2.0 license_treatment: permissive maintenance: active --- # tortoise-orm — Easy async ORM for python, built with relations in mind License: permissive · Maintenance: active · Downloads: 636.5K/mo ## 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 above — 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 pip install tortoise-orm uv add tortoise-orm 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_current - Install friction: low - Maintenance: active - Downloads: 636.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags async orm python, asyncio database mapper, django-like orm async, async sql query builder, python async database orm, tortoise orm, async relational mapper, async-first, migrations, multi-database [View on SkillFed](https://skillfed.io/packages/tortoise-orm) · [View on PyPI](https://pypi.org/project/tortoise-orm/)