2.1.5
- Added the Unmapped annotation and the unmapped_column() construct, providing a declarative-compatible way to have excluded columns in a Declarative model that are part of the Table but not mapped, replacing use of Mapper.exclude_properties for this purpose
- Fixed regression from issue 11917 in version 2.0.36 where an ORM-enabled update() using WHERE criteria matching more than one object in the Session expired server-side onupdate columns and SQL-expression SET columns on only one of the matched objects; the columns are now expired for all matched objects
- Fixed issue where dialect-specific keyword arguments on ForeignKeyConstraint, ForeignKey or CheckConstraint, such as postgresql_not_valid, were not carried along to the copy produced by Table.to_metadata(), so the copied Table generated DDL without these options
- Fixed issue where a task cancelled a second time while the connection pool was closing an asyncio connection invalidated by the first cancellation would leave the closed connection in the pool; the pool now discards the connection in all cases once a close has been attempted
- Fixed regression from issue 13548 where an asyncio cancellation delivered while the pool was closing a connection stranded by an exception in the PoolEvents.connect() handler was suppressed; the CancelledError is now propagated and other cancellation scenarios were repaired
- Using Mapper.exclude_properties or Mapper.include_properties on a Declarative mapping to exclude attributes declared on the class, such as with mapped_column(), is deprecated and emits a deprecation warning; unmapped_column() should be used instead, while excluding columns present only in the Table is not affected
1 change to check, marked in the notes below
From SQLAlchemy
Released: October 16, 2026
orm
-
[orm] [feature] Added the
_orm.Unmappedannotation and the_orm.unmapped_column()construct, providing a declarative-compatible approach to having "excluded" columns in a Declarative model, that is, columns that are part of the_schema.Tablebut are not mapped, replacing the use of_orm.Mapper.exclude_propertiesfor this purpose when using a Declarative mapping.References: #13650
-
[orm] [bug] [regression] Fixed regression caused by #11917 in version 2.0.36 where an ORM enabled
_sql.update()using WHERE criteria which matched more than one object present in the_orm.Sessionwould expire server-side onupdate columns, as well as columns that were SET to a SQL expression, on only one of the matched objects, leaving the remaining objects with stale values for those attributes. The columns are now expired for all matched objects.This change is also backported to: 2.0.55
References: #13675
-
[orm] [deprecated] Using the
_orm.Mapper.exclude_propertiesor_orm.Mapper.include_propertiesparameters on a Declarative mapping to exclude attributes that are declared on the class, such as with_orm.mapped_column(), is deprecated and now emits a deprecation warning. This use was never supported, and depending on the arguments passed to_orm.mapped_column(), the attribute could remain mapped regardless; in particular, as of 2.1 this includes ORM mapped dataclasses where_orm.mapped_column.defaultis present. The new_orm.unmapped_column()construct should be used instead. Excluding columns that are present only in the_schema.Table, such as those from__table__,__table_args__or table reflection, is not affected. deprecated · inferredReferences: #13650
schema
-
[schema] [bug] Fixed issue where dialect-specific keyword arguments established on a
ForeignKeyConstraint,ForeignKeyorCheckConstraint, such aspostgresql_not_valid, were not carried along to the copy of the constraint produced byTable.to_metadata(), so that the copiedTablewould generate DDL without these options. The fix for #5276 had established this behavior forColumn,PrimaryKeyConstraintandUniqueConstraintonly.This change is also backported to: 2.0.55
References: #13677
asyncio
-
[asyncio] [bug] Fixed issue where a task that was cancelled a second time while the connection pool was closing an asyncio connection invalidated by the first cancellation, such as one received while a statement was executing, would leave the closed connection in place in the pool, where it would be handed out to the next checkout and fail upon first use. The pool now discards the connection in all cases once a close has been attempted. This condition occurs unconditionally for tasks cancelled by an AnyIO cancel scope, which delivers the cancellation repeatedly until the task exits the scope.
This change is also backported to: 2.0.55
References: #13673
-
[asyncio] [bug] Fixed regression caused by #13548 where an asyncio cancellation delivered while the pool was closing a connection stranded by an exception raised within the
_events.PoolEvents.connect()event handler would be suppressed, with the original exception raised in its place. The task would then not end as cancelled, and code that catches ordinary exceptions in order to retry would continue running after it had been cancelled. TheCancelledErroris now propagated.As part of this change, a variety of other cancellation scenarios were caught and repaired.
This change is also backported to: 2.0.55
References: #13678