Change8

SQLAlchemy

Backend & Infra

The Database Toolkit for Python

Latest: rel_2_0_4711 releases1 breaking changes10 common errorsView on GitHub

Release History

rel_2_0_477 fixes1 feature
Feb 24, 2026

This release focuses heavily on bug fixes across PostgreSQL and SQLite dialects related to ON CONFLICT handling and batching, alongside an ORM fix for Python 3.14 annotations and a new feature allowing raw connections to be used as context managers.

rel_2_1_0b110 features
Jan 21, 2026

This release introduces support for free-threaded Python wheels and significant ORM enhancements, including new session execution options and improved composite attribute handling. It also drops support for Python versions older than 3.10.

rel_2_0_466 fixes2 features
Jan 21, 2026

This release focuses heavily on bug fixes across multiple dialects, including improved type checking support for ORM entities, correct SQL generation for PostgreSQL JSONB operations, and compatibility fixes for MariaDB sequences and the aiosqlite driver.

rel_2_0_4511 fixes2 features
Dec 9, 2025

SQLAlchemy 2.0.45 introduces PostgreSQL collation reflection and MySQL FOR SHARE support, while fixing numerous bugs across ORM, SQL, typing, and SQLite reflection.

rel_2_0_4411 fixes2 features
Oct 10, 2025

SQLAlchemy 2.0.44 introduces refined ORM type‑alias handling, adds the `_orm.mapped_as_dataclass()` decorator, and fixes numerous bugs across platforms, engines, and dialects.

rel_2_0_434 fixes2 features
Aug 11, 2025

SQLAlchemy 2.0.43 introduces a new `skip_autocommit_rollback` engine option and adds sparse vector support to Oracle, while fixing several ORM and PostgreSQL bugs.

rel_2_0_428 fixes7 features
Jul 29, 2025

SQLAlchemy 2.0.42 adds dataclass metadata support, new loader options for composites, enhanced execution‑parameter validation, a VALUES‑CTE helper, PostgreSQL 14+ JSONB subscripting, and numerous bug fixes across ORM, SQL compilation, and dialects.

rel_2_0_416 fixes2 features
May 14, 2025

SQLAlchemy 2.0.41 introduces PostgreSQL and Oracle enhancements, fixes several bugs across multiple dialects, and improves Python 3.14 beta compatibility.

rel_2_0_408 fixes3 features
Mar 27, 2025

SQLAlchemy 2.0.40 adds GROUPS frame support for window functions, enhances PostgreSQL foreign‑key ON DELETE actions and ARRAY literals, and includes numerous bug fixes across ORM, SQL compilation, asyncio, and MySQL/SQLite dialects.

rel_2_0_3910 fixes2 features
Mar 11, 2025

SQLAlchemy 2.0.39 introduces generic typing for compound selects and new constraint isolation parameters, while fixing numerous ORM, asyncio, PostgreSQL, and SQLite bugs.

rel_2_0_38Breaking6 fixes1 feature
Feb 6, 2025

SQLAlchemy 2.0.38 introduces a new asyncio.shield() safeguard for asyncpg termination, fixes several bugs across engines and dialects, and changes the default aiosqlite pool, which may require a migration step.

Common Errors

InvalidRequestError5 reports

InvalidRequestError in SQLAlchemy usually arises from calling database operations outside a properly established session or transaction context. To fix it, ensure you are operating within a `with session.begin()` block or have explicitly started and committed/rolled back a session before closing it. Also double-check that the session is properly bound to the engine before use, especially in asynchronous contexts with multiple concurrent requests.

NotImplementedError3 reports

NotImplementedError in SQLAlchemy usually means a specific database backend or feature combination lacks implementation for a requested function. To fix this, either choose a different database backend supporting the feature, or contribute the missing implementation to the SQLAlchemy dialect for the current backend, ensuring all necessary logic for the operation is present. If it's related to subqueries or complex constructs, try simplifying the query or using alternative SQLAlchemy functions supported by your backend.

TypeError1 report

The TypeError usually arises when SQLAlchemy expects a `TypeEngine` object (like `String`, `Integer`, `Date`), but receives a plain Python type (like `str`, `int`, `datetime.date`). To fix it, ensure you're using the SQLAlchemy type objects directly in your table definitions; import them from `sqlalchemy` (e.g., `from sqlalchemy import String, Integer, Date`). Avoid passing the Python type directly to the `Column` constructor.

MappedAnnotationError1 report

MappedAnnotationError usually arises when SQLAlchemy cannot infer the database column type from a Python type annotation. Ensure your model attribute has a well-defined `sqlalchemy.Column` with an explicit `sqlalchemy.types` type (e.g., `sqlalchemy.Integer`, `sqlalchemy.String`) or use `Mapped[SomeType]` alongside a corresponding SQLAlchemy type in the column definition to guide SQLAlchemy.

NoSuchColumnError1 report

NoSuchColumnError in SQLAlchemy usually occurs when your query references a column that either doesn't exist in the mapped table or hasn't been explicitly included in the query's selection. Ensure your table definition accurately reflects the database schema and that all required columns are present in the session's query or explicitly loaded using options like `load_only` or `defer` if they are not immediately needed. Verify the column names in your query match those defined in your SQLAlchemy model to avoid typos or misconfigurations.

InvalidInputException1 report

InvalidInputException in SQLAlchemy usually arises from providing incorrect or unsupported parameters in your database connection string or when executing a query. Double-check the database connection URL for typos, ensure all parameters are supported by the database driver (e.g., `saas_mode=true` for MotherDuck), and verify the data types/values being passed in queries that might clash with the database schema. Consult the database driver's documentation for valid parameter names and supported configurations.

Related Backend & Infra Packages

Subscribe to Updates

Get notified when new versions are released

RSS Feed