sqlalchemy2-stubs
Typing Stubs for SQLAlchemy 1.4
What it is and what it does
sqlalchemy2-stubs provides typing stub files (PEP-484) for SQLAlchemy 1.4, allowing static type checkers to understand SQLAlchemy's ORM API and catch type errors at development time. The stubs are designed to work alongside a mypy extension plugin, which adds special handling for ORM mapped classes.
This package is explicitly a bridge for SQLAlchemy 1.4 users and is not compatible with SQLAlchemy 2.0, which ships with inline type annotations. The project is in alpha status and dormant—released concurrently with SQLAlchemy 1.4 and no longer actively maintained. Users upgrading to SQLAlchemy 2.0 must manually uninstall these stubs to avoid conflicts with the library's native typing.
Use it for:
- Enable type checking on SQLAlchemy 1.4 ORM code to catch column access and relationship errors before runtime.
- Provide IDE autocomplete and type hints for SQLAlchemy models and query objects in editors supporting PEP-484 stubs.
- Validate type consistency in legacy SQLAlchemy 1.4 projects during migration planning or refactoring.
- Support gradual typing adoption in existing SQLAlchemy 1.4 codebases without rewriting the library itself.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides PEP-484 typing stubs for SQLAlchemy 1.4, enabling static type checking with mypy and other type checkers.
Yes, if you are actively maintaining SQLAlchemy 1.4 code and want static type checking. The low install friction and permissive MIT license make it straightforward to add. However, this is a legacy package: it is dormant, explicitly incompatible with SQLAlchemy 2.0, and must be manually uninstalled before upgrading. Do not install if you are on or planning to migrate to SQLAlchemy 2.0.
Install
sqlalchemy2-stubs on PyPI
pip
pip install sqlalchemy2-stubsuv
uv add sqlalchemy2-stubspoetry
poetry add sqlalchemy2-stubsInstalling sqlalchemy2-stubs
Before you install
Low install friction with a single lightweight dependency on typing-extensions. Maintenance is dormant—last commit was 2023-12-30 and no releases in 958 days—which is expected for a legacy typing stub package.
License in practice
MIT license permits permissive use, modification, and distribution with minimal restrictions, making it safe to adopt in most projects.
Quickstart
pip install sqlalchemy2-stubs typing-extensions
from typing_extensions import TypedDict
# Use with SQLAlchemy 1.4 ORM code for type checking
Only compatible with SQLAlchemy 1.4; must be manually uninstalled before upgrading to SQLAlchemy 2.0, which includes inline typing and will conflict with these stubs.
Verify before relying
- Whether the stubs cover the full SQLAlchemy 1.4 API surface or only a subset (description notes 'interim' and 'alpha level').
- Current compatibility with modern type checker versions and whether the accompanying mypy plugin is still maintained.
- Practical compatibility with PyPy, given the classifier lists it as supported.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing-extensions |
| Maintenance | dormant — 958 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,580,257/month — #2,990 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sqlalchemy2_stubs-0.0.2a38-py3-none-any.whl
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
homeassistant-stubsProvides PEP 484 type stubs for Home Assistant…
permissive · top 15,000 on PyPI
sqlalchemy-stubsProvides type stubs and a mypy plugin to enable…
permissive · top 5,000 on PyPI
types-SQLAlchemyProvides PEP 561 type stubs for SQLAlchemy,…
permissive · top 15,000 on PyPI
django-filter-stubsProvides PEP-484 type stubs for django-filter…
permissive · top 15,000 on PyPI
djangorestframework-stubsProvides PEP-484 type stubs for Django REST…
permissive · top 5,000 on PyPI
types-Flask-SQLAlchemyProvides type stubs for Flask-SQLAlchemy to…
permissive · top 15,000 on PyPI
lxml-stubsProvides type annotations for the lxml package…
permissive · top 5,000 on PyPI
SQLAlchemySQLAlchemy is a Python SQL toolkit and Object…
permissive · top 100 on PyPI
sqlalchemy-mixinsProvides Active Record-style mixins for…
permissive · top 15,000 on PyPI
sqlalchemy-firebirdProvides a SQLAlchemy 2.0+ dialect for…
permissive · top 15,000 on PyPI