What’s New in SQLAlchemy 2.1?

This document details the changes made in SQLAlchemy versions 2.0 and 2.1. In version 2.0, PEP 484 typing was implemented extensively, allowing for the tracking of individual column types in row-returning statements like select(). Version 2.1 introduced PEP 646 integration to address issues around typing.Tuple. SQLAlchemy now uses automated tools for stub generation to handle mappings of expressions within select() efficiently. However, limitations remain, such as the inability to automatically type name-based attributes on Row objects. Notably, the asyncio “greenlet” dependency is no longer installed by default, impacting users of the asyncio extension. Additionally, relationship.back_populates now accepts both direct references and lambdas for improved linting and type checking. #10635 #10197 #10050

https://docs.sqlalchemy.org/en/21/changelog/migration_21.html

To top