2.0.14
Released: May 18, 2023
orm
-
[orm] [bug] Modified the
JoinedLoader
implementation to use a simpler approach in
one particular area where it previously used a cached structure that would
be shared among threads. The rationale is to avoid a potential race
condition which is suspected of being the cause of a particular crash
that's been reported multiple times. The cached structure in question is
still ultimately "cached" via the compiled SQL cache, so a performance
degradation is not anticipated.References: #9777
-
[orm] [bug] [regression] Fixed regression where use of
_dml.update()
or_dml.delete()
within a_sql.CTE
construct, then used in a_sql.select()
,
would raise aCompileError
as a result of ORM related rules for
performing ORM-level update/delete statements.References: #9767
-
[orm] [bug] Fixed issue in new ORM Annotated Declarative where using a
_schema.ForeignKey
(or other column-level constraint) inside of
_orm.mapped_column()
which is then copied out to models via pep-593
Annotated
would apply duplicates of each constraint to the
_schema.Column
as produced in the target_schema.Table
,
leading to incorrect CREATE TABLE DDL as well as migration directives under
Alembic.References: #9766
-
[orm] [bug] Fixed issue where using additional relationship criteria with the
_orm.joinedload()
loader option, where the additional criteria itself
contained correlated subqueries that referred to the joined entities and
therefore also required "adaption" to aliased entities, would be excluded
from this adaption, producing the wrong ON clause for the joinedload.References: #9779
sql
-
[sql] [usecase] Generalized the MSSQL
_sql.try_cast()
function into the
sqlalchemy.
import namespace so that it may be implemented by third
party dialects as well. Within SQLAlchemy, the_sql.try_cast()
function remains a SQL Server-only construct that will raise
CompileError
if used with backends that don't support it._sql.try_cast()
implements a CAST where un-castable conversions are
returned as NULL, instead of raising an error. Theoretically, the construct
could be implemented by third party dialects for Google BigQuery, DuckDB,
and Snowflake, and possibly others.Pull request courtesy Nick Crews.
References: #9752
-
[sql] [bug] Fixed issue in
_sql.values()
construct where an internal compilation
error would occur if the construct were used inside of a scalar subquery.References: #9772
postgresql
-
[postgresql] [bug] Fixed apparently very old issue where the
_postgresql.ENUM.create_type
parameter, when set to its
non-default ofFalse
, would not be propagated when the
_schema.Column
which it's a part of were copied, as is common when
using ORM Declarative mixins.References: #9773
tests
-
[tests] [bug] [pypy] Fixed test that relied on the
sys.getsizeof()
function to not run on
pypy, where this function appears to have different behavior than it does
on cpython.References: #9789