Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. FastAPI
  3. Fastapi-SQLA

Fastapi-SQLA

MITPythonv3.7.1

A production-ready SQLAlchemy extension for FastAPI with built-in pagination, async support, SQLModel integration, and pytest fixtures.

GitHubGitHub
445 stars18 forks0 contributors

What is Fastapi-SQLA?

Fastapi-SQLA is a SQLAlchemy extension for FastAPI that provides essential database utilities like pagination, session management, and testing support. It solves the problem of integrating SQLAlchemy with FastAPI in a production-ready manner, offering async compatibility and seamless SQLModel integration.

Target Audience

Backend developers building FastAPI applications with SQLAlchemy who need robust database utilities, pagination, and testing support.

Value Proposition

Developers choose Fastapi-SQLA for its production-ready features, minimal configuration, and comprehensive support for modern Python async patterns and SQLAlchemy 2.0.

Overview

SQLAlchemy extension for FastAPI with support for pagination, asyncio, SQLModel and pytest, ready for production.

Use Cases

Best For

  • Adding pagination to FastAPI endpoints with SQLAlchemy queries
  • Building async FastAPI applications with PostgreSQL using asyncpg
  • Integrating SQLModel with FastAPI for type-safe database operations
  • Testing FastAPI applications with pre-configured database fixtures
  • Managing multiple database sessions in a single FastAPI application
  • Simplifying SQLAlchemy session injection in FastAPI dependency system

Not Ideal For

  • Applications using asynchronous databases other than PostgreSQL, as async support is specifically tied to asyncpg and PostgreSQL.
  • Projects that require minimal database abstraction and prefer to handle SQLAlchemy sessions and pagination manually without extra utilities.
  • Teams already using alternative FastAPI-SQLAlchemy integrations like the FastAPI-SQLAlchemy library, as migration might not justify the switch.
  • Simple CRUD APIs where the overhead of configuring multi-session support and pagination is unnecessary for basic operations.

Pros & Cons

Pros

Built-in Pagination

Offers customizable pagination with async compatibility, simplifying endpoint creation in FastAPI, as shown with Paginate and Page response models in examples.

Seamless SQLModel Integration

Provides full compatibility with SQLModel for type-safe database interactions without additional setup, demonstrated in the SQLModel support section.

Production Testing Fixtures

Includes pre-configured Pytest fixtures with automatic transaction rollback and Alembic migration support, easing testing workflows for database operations.

Async Session Management

Supports asyncio with asyncpg for PostgreSQL, enabling non-blocking queries in FastAPI, detailed in the async support configuration.

Cons

PostgreSQL-Centric Async

Async functionality is limited to PostgreSQL via asyncpg, with no native support for other async database drivers, restricting database flexibility.

Complex Multi-Session Setup

Configuring multiple sessions requires specific environment variable naming and SQLAlchemy engine knowledge, adding initial complexity.

Alembic Dependency for Testing

Pytest fixtures assume Alembic for migrations, which may not align with projects using other migration tools or custom strategies.

Frequently Asked Questions

Quick Stats

Stars445
Forks18
Contributors0
Open Issues6
Last commit2 days ago
CreatedSince 2020

Tags

#fastapi#orm#database#pytest#library#async#python#pagination#sqlalchemy#sqlmodel#backend#fastapi-sqlalchemy

Built With

F
FastAPI
A
Alembic
a
asyncpg
S
SQLAlchemy
S
SQLModel
P
Poetry
P
Python
p
pytest

Included in

FastAPI11.2k
Auto-fetched 1 day ago

Related Projects

PiccoloPiccolo

A fast, user friendly ORM and query builder which supports asyncio.

Stars1,925
Forks109
Last commit12 days ago
ORMORM

An async ORM. 🗃

Stars1,863
Forks96
Last commit3 years ago
AerichAerich

A database migrations tool for TortoiseORM, ready to production.

Stars1,088
Forks113
Last commit2 days ago
FastAPI SQLAlchemyFastAPI SQLAlchemy

Adds simple SQLAlchemy support to FastAPI

Stars757
Forks43
Last commit2 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub