skillfed

sqlalchemy2-stubs

Typing Stubs for SQLAlchemy 1.4

sqlalchemy2-stubs v0.0.2a38 2.6M downloads/30d#2,990 on PyPI157
Permissive license MIT DORMANT released

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-stubs

uv

uv add sqlalchemy2-stubs

poetry

poetry add sqlalchemy2-stubs

Installing 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

Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

sqlalchemy type stubssqlalchemy mypy typingsqlalchemy 1.4 type hintssqlalchemy static type checkingpep 484 sqlalchemy stubssqlalchemy type annotations
type-stubssqlalchemy-1.4legacy

More Database packages

psycopg2-binary

psycopg2-binary is a PostgreSQL database…

copyleft · top 1,000 on PyPI

redis

Python client library for connecting to and…

permissive · top 1,000 on PyPI

ydb

YDB Python SDK is the official client library…

permissive · top 1,000 on PyPI

snowflake-connector-python

Connects Python applications to Snowflake data…

permissive · top 1,000 on PyPI

sqlparse

sqlparse tokenizes SQL text into a tree of…

permissive · top 1,000 on PyPI

dbt-adapters

Provides base adapter protocols and shared…

permissive · top 1,000 on PyPI

homeassistant-stubs

Provides PEP 484 type stubs for Home Assistant…

permissive · top 15,000 on PyPI

sqlalchemy-stubs

Provides type stubs and a mypy plugin to enable…

permissive · top 5,000 on PyPI

types-SQLAlchemy

Provides PEP 561 type stubs for SQLAlchemy,…

permissive · top 15,000 on PyPI

django-filter-stubs

Provides PEP-484 type stubs for django-filter…

permissive · top 15,000 on PyPI

djangorestframework-stubs

Provides PEP-484 type stubs for Django REST…

permissive · top 5,000 on PyPI

types-Flask-SQLAlchemy

Provides type stubs for Flask-SQLAlchemy to…

permissive · top 15,000 on PyPI

lxml-stubs

Provides type annotations for the lxml package…

permissive · top 5,000 on PyPI

SQLAlchemy

SQLAlchemy is a Python SQL toolkit and Object…

permissive · top 100 on PyPI

sqlalchemy-mixins

Provides Active Record-style mixins for…

permissive · top 15,000 on PyPI

sqlalchemy-firebird

Provides a SQLAlchemy 2.0+ dialect for…

permissive · top 15,000 on PyPI