2.1.4
Released: October 7, 2026
orm
-
[orm] [bug] [regression] Fixed regression caused by #13333 where assigning a
MetaDataobject to themetadataattribute of a mapped
Declarative class, in order to place that class'sTablein a
MetaDatacollection other than that of the
_orm.registry, would emit a warning that the attribute name
metadatashould be left reserved. The warning is now emitted only
when themetadataattribute is assigned to an object other than a
MetaData.References: #13659
engine
-
[engine] [bug] [regression] Fixed regression from the 1.4 series where the DBAPI cursor used for a
compiled statement that returns no rows, which includes DDL constructs
such asCreateTableandDropTableas well as the
SAVEPOINT, ROLLBACK TO SAVEPOINT and RELEASE SAVEPOINT statements emitted
by_engine.Connection.begin_nested(), was not closed after
execution, and was instead left to be released when garbage collected.
The cursor is now closed immediately, as was the case in 1.3 and as is
already the case for INSERT, UPDATE, DELETE and_sql.text()
statements.This change is also backported to: 2.0.55
References: #13640
-
[engine] [bug] Fixed issue in the
_engine.Connection.execution_options.logging_tokenoption
where setting the value toNoneor another false value would raise
AttributeErrorif a logging token had not already been established on
that_engine.Connection, such as on a newly checked out
connection, when the option was set at the_engine.Enginelevel,
or when the token was reset toNonemore than once. Regression
introduced in 2.0.30 as part of #11210.This change is also backported to: 2.0.55
References: #13641
-
[engine] [bug] [regression] Fixed regression where iterating a
Resultdirectly would create
reference cycles that prevented theResultalong with the DBAPI
cursor from being freed immediately, instead relying upon cyclic GC to free
it; also fixed a similar issue when using scalar-returning methods such as
Result.scalars(). The issues were introduced as part of a 2.1
refactoring ofResultinto Cython code.References: #13639
-
[engine] [bug] Fixed issue where an exception raised by the rollback performed within
_engine.Connection.close(), which was not otherwise classified as a
disconnect, would leave the_engine.Connectionopen and its
pooled DBAPI connection checked out, emitting a warning when later
garbage collected; for an asyncio driver, the connection could not be
closed at that point and was leaked. The DBAPI connection is now
returned to the pool, which resets it as usual, invalidating it if that
reset fails as well, and the original exception is raised.References: #13657
sql
-
[sql] [bug] Fixed issue where the
UpdateBase.return_defaults.supplemental_colsparameter of
UpdateBase.return_defaults()was not included in the cache key of
anInsertorUpdateconstruct, causing a statement
that used this parameter to share a cached compiled form with an otherwise
identical statement that did not, or that used different supplemental
columns. This would cause the supplemental RETURNING rows to be missing
or incorrect depending on which form of the statement was compiled first.This change is also backported to: 2.0.55
-
[sql] [bug] [regression] Fixed regression where stringifying a statement that includes the
_functions.aggregate_stringsfunction, such as viastr(),
would raiseTypeError. Additionally, compiling the function with the
default dialect or with a third party dialect that doesn't provide its own
rendering for this function now raisesCompileErrorrather than
TypeError.References: #13642
postgresql
-
[postgresql] [bug] Fixed regression where copying a
_postgresql.DOMAINdatatype,
as occurs when usingTypeEngine.copy(),Table.to_metadata(),
or when aColumnreferring to a_postgresql.DOMAINis
placed on a declarative mixin, would drop the
_postgresql.DOMAIN.collation,
_postgresql.DOMAIN.default,
_postgresql.DOMAIN.constraint_name,
_postgresql.DOMAIN.not_nulland
_postgresql.DOMAIN.checkparameters, causing the
CREATE DOMAINstatement emitted for the copied type to omit these
elements. The regression was introduced in version 2.0.42.Additionally, copies of
_postgresql.ENUMnow retain the
_types.Enum.sort_key_function,
_types.Enum.create_constraintand
_types.Enum.lengthparameters, and copies of
_types.Enumnow retain the
_types.Enum.sort_key_functionparameter, all of which were
previously reset to their default values.This change is also backported to: 2.0.55
References: #13644
-
[postgresql] [bug] [regression] Fixed regression in the asyncpg dialect where a failure to start a
transaction, such as when an asyncpg connection is used from a different
event loop than the one it was created on, would leave the failed asyncpg
transaction in place, so that the subsequent rollback raised an
InterfaceErrorthat masked the original error.References: #13657
mssql
-
[mssql] [bug] Fixed issue where the Python true division operator
/would truncate
the fractional part of the divisor on SQL Server when the divisor's type
was not numeric, such as when using a SQL function likeNULLIF()that
has no known return type. The divisor was rendered asCAST(... AS NUMERIC), which on SQL Server implies a scale of zero; the divisor is
now rendered as(... + 0.0), the same approach used by the SQLite
dialect, which promotes it to a decimal value without truncation.
Pull request courtesy James Guthrie.This change is also backported to: 2.0.55
References: #13631
misc
-
[bug] [ext] Fixed issue in the
mutable_toplevelextension where the in-place
|=operator onMutableDictand the in-place*=operator
onMutableListdid not emit change events, so that the
modification was not detected and was not persisted on the next flush.
These operators now invokeMutable.changed()in the same way as
the in-place set operators ofMutableSetand the+=
operator ofMutableList.This change is also backported to: 2.0.55
References: #13643