awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·

Type-Safe Python ORMs and Query Builders

Ranking updated Jun 30, 2026

For a type-safe ORM for Python, the strongest matches are tortoise/tortoise-orm (Tortoise ORM is an async ORM for Python with), fastapi/sqlmodel (SQLModel is a type-safe Python ORM and query builder) and sqlalchemy/sqlalchemy (SQLAlchemy is the leading Python ORM and query builder). piccolo-orm/piccolo and ormar-orm/ormar round out the shortlist. Each is ranked by relevance to your query, popularity and recent activity.

Discover Python libraries that provide robust type checking and autocompletion for database interactions and queries.

Type-Safe Python ORMs and Query Builders

Find the best repos with AI.We'll search the best matching repositories with AI.
  • tortoise/tortoise-ormtortoise avatar

    tortoise/tortoise-orm

    5,582View on GitHub↗

    Tortoise ORM is an asynchronous object-relational mapper for Python that mirrors Django's model and queryset API while running on asyncio. It defines database tables as Python classes with typed fields and supports foreign key, many-to-many, and one-to-one relations, providing a chainable query API for filtering, annotating, grouping, and prefetching related objects without blocking the event loop. The ORM includes a built-in migration engine that detects model changes, generates migration files, and applies or reverts schema changes through a command-line tool. It connects to PostgreSQL, MyS

    Tortoise ORM is an async ORM for Python with a chainable queryset API (query builder), typed model fields, migration support, and multiple database backends, directly matching the request for a type-safe ORM with query builder; it covers most features but does not explicitly provide raw SQL with type validation.

    PythonAsync Python ORMs with RelationsAsync-Await ORM CoresORM Data Models
    View on GitHub↗5,582
  • fastapi/sqlmodelfastapi avatar

    fastapi/sqlmodel

    18,137View on GitHub↗

    SQLModel is a type-safe object-relational mapping library for Python that integrates database schema definitions with data validation logic. By combining these two roles into a single class, it allows developers to manage relational data structures and enforce data integrity for web APIs simultaneously. The framework is built to support asynchronous database operations, enabling high-performance applications to execute queries and transactions without blocking the main execution thread. The library distinguishes itself by leveraging Python type hints to provide IDE autocompletion and compile-

    SQLModel is a type-safe Python ORM and query builder that uses Pydantic for validation and type hints, supporting async operations, migrations, and multiple databases with full query-building capabilities, making it an excellent fit for this search.

    PythonType-Safe Query Builders
    View on GitHub↗18,137
  • sqlalchemy/sqlalchemysqlalchemy avatar

    sqlalchemy/sqlalchemy

    11,612View on GitHub↗

    SQLAlchemy is a comprehensive Python SQL toolkit and object-relational mapper that provides a full suite of tools for interacting with relational databases. It serves as a foundational layer for database connectivity, offering both a high-level object-oriented interface for data persistence and a programmatic SQL expression language for constructing complex, dialect-agnostic queries. The project distinguishes itself through its sophisticated unit of work persistence, which coordinates atomic transactions and tracks object state changes to minimize redundant database operations. It provides a

    SQLAlchemy is the leading Python ORM and query builder, now with first-class type-hinted schema definitions (Mapped, mapped_column) in version 2.0, async support, comprehensive relationship handling, and broad database coverage — squarely meeting your search for a type-safe ORM and query builder.

    PythonAsynchronous SQL ToolkitsObject-Relational MappingSQL Query Builders
    View on GitHub↗11,612
  • piccolo-orm/piccolopiccolo-orm avatar

    piccolo-orm/piccolo

    1,913View on GitHub↗

    Piccolo is an async Python ORM with a built-in type-safe query builder that uses type hints, directly fitting the search's core requirement; it supports async, migrations, relationships, and PostgreSQL/SQLite, though it may not cover MySQL or raw SQL type validation as fully.

    PythonDatabase ClientsDatabase DriversDatabase ORMs and ODMs
    View on GitHub↗1,913
  • ormar-orm/ormarormar-orm avatar

    ormar-orm/ormar

    1,805View on GitHub↗

    Ormar is an asynchronous object-relational mapper for Python that integrates database persistence with data validation. It functions as a bridge between relational database management and application-level data structures, allowing developers to define database schemas that serve simultaneously as validation models. The project distinguishes itself by using validation classes to enforce schema integrity, ensuring that all persisted records conform to defined types and structures. It supports complex relational associations, including one-to-many and many-to-many relationships, and provides ev

    ormar is an async Python ORM built on Pydantic for automatic type validation and alignment with FastAPI, covering the core type-safe ORM and query-building needs with migration support via Alembic and async database access.

    PythonAsync Python ORMs with Relations
    View on GitHub↗1,805

Related searches

  • a type-safe ORM for TypeScript applications
  • a TypeScript-first ORM for SQL databases
  • an ORM and query builder for Go
  • an object relational mapper for Rust
  • an object relational mapping library for Kotlin
  • checked SQL queries for Rust
  • an object relational mapping library for Dart
  • a data validation library using Python type hints