1.4.10
Released: April 20, 2021
orm
-
[orm] [usecase] Altered some of the behavior repaired in #6232 where the
immediateload
loader strategy no longer goes into recursive loops; the
modification is that an eager load (joinedload, selectinload, or
subqueryload) from A->bs->B which then statesimmediateload
for a
simple manytoone B->a->A that's in the identity map will populate the B->A,
so that this attribute is back-populated when the collection of A/A.bs are
loaded. This allows the objects to be functional when detached. -
[orm] [bug] Fixed bug in new
_orm.with_loader_criteria()
feature where using a
mixin class with_orm.declared_attr()
on an attribute that were
accessed inside the custom lambda would emit a warning regarding using an
unmapped declared attr, when the lambda callable were first initialized.
This warning is now prevented using special instrumentation for this
lambda initialization step.References: #6320
-
[orm] [bug] [regression] Fixed additional regression caused by the "eagerloaders on refresh" feature
added in #1763 where the refresh operation historically would set
populate_existing
, which given the new feature now overwrites pending
changes on eagerly loaded objects when autoflush is false. The
populate_existing flag has been turned off for this case and a more
specific method used to ensure the correct attributes refreshed.References: #6326
-
[orm] [bug] [result] Fixed an issue when using 2.0 style execution that prevented using
_result.Result.scalar_one()
or
_result.Result.scalar_one_or_none()
after calling
_result.Result.unique()
, for the case where the ORM is returning a
single-element row in any case.References: #6299
sql
-
[sql] [bug] Fixed issue in SQL compiler where the bound parameters set up for a
Values
construct wouldn't be positionally tracked correctly if
inside of a_sql.CTE
, affecting database drivers that support
VALUES + ctes and use positional parameters such as SQL Server in
particular as well as asyncpg. The fix also repairs support for
compiler flags such asliteral_binds
.References: #6327
-
[sql] [bug] Repaired and solidified issues regarding custom functions and other
arbitrary expression constructs which within SQLAlchemy's column labeling
mechanics would seek to usestr(obj)
to get a string representation to
use as an anonymous column name in the.c
collection of a subquery.
This is a very legacy behavior that performs poorly and leads to lots of
issues, so has been revised to no longer perform any compilation by
establishing specific methods onFunctionElement
to handle this
case, as SQL functions are the only use case that it came into play. An
effect of this behavior is that an unlabeled column expression with no
derivable name will be given an arbitrary label starting with the prefix
"_no_label"
in the.c
collection of a subquery; these were
previously being represented either as the generic stringification of that
expression, or as an internal symbol.References: #6256
schema
-
[schema] [usecase] [mssql] The
_types.DateTime.timezone
parameter when set toTrue
will now make use of theDATETIMEOFFSET
column type with SQL Server
when used to emit DDL, rather thanDATETIME
where the flag was silently
ignored.References: #6306
-
[schema] [bug] Fixed issue where
_functions.next_value()
was not deriving its type
from the corresponding_schema.Sequence
, instead hardcoded to
_types.Integer
. The specific numeric type is now used.References: #6287
mypy
-
[mypy] [bug] Fixed issue where mypy plugin would not correctly interpret an explicit
_orm.Mapped
annotation in conjunction with a
_orm.relationship()
that refers to a class by string name; the
correct annotation would be downgraded to a less specific one leading to
typing errors.References: #6255
misc
-
[bug] [declarative] [regression] Fixed
_declarative.instrument_declarative()
that called
a non existing registry method.References: #6291