Async ORM for Python inspired by Django ORM. Built on asyncio — requires async context. Current version: 1.1.7 (Mar 2026). v1.0 released 2024 — first stable release after years of 0.x. Breaking changes from 0.x: connections.close_all() removed, ConnectionHandler uses per-instance ContextVar storage. FastAPI integration changed from register_tortoise() to RegisterTortoise context manager. Does not work on serverless/Vercel without workarounds.
pip install tortoise-ormVerified import paths — ran on the pinned version, not inferred.
Tortoise ORM v1.x standalone script with PostgreSQL.
Use Tortoise.close_connections() instead.
Pass _enable_global_fallback=False to RegisterTortoise for secondary apps.
modules={'models': ['myapp.models.user', 'myapp.models.post']} — list ALL model files.Not recommended for serverless. Use asyncpg directly or a serverless-compatible ORM.
Set generate_schemas=False in production. Use aerich for migrations: pip install aerich
Test pydantic_model_creator() output after upgrading to v1.0.
pip install 'tortoise-orm[asyncpg]' for PostgreSQL, 'tortoise-orm[asyncmy]' for MySQL, 'tortoise-orm[aiosqlite]' for SQLite.
Ensure your database server (e.g., PostgreSQL) is running and accessible from the application's environment on the configured host and port. Verify database server logs, firewall rules, and the connection string (TORTOISE_CONFIG) used by Tortoise-ORM.