1.4.30
Released: January 19, 2022
orm
-
[orm] [bug] Fixed issue in joined-inheritance load of additional attributes
functionality in deep multi-level inheritance where an intermediary table
that contained no columns would not be included in the tables joined,
instead linking those tables to their primary key identifiers. While this
works fine, it nonetheless in 1.4 began producing the cartesian product
compiler warning. The logic has been changed so that these intermediary
tables are included regardless. While this does include additional tables
in the query that are not technically necessary, this only occurs for the
highly unusual case of deep 3+ level inheritance with intermediary tables
that have no non primary key columns, potential performance impact is
therefore expected to be negligible.References: #7507
-
[orm] [bug] Fixed issue where calling upon
_orm.registry.map_imperatively()
more
than once for the same class would produce an unexpected error, rather than
an informative error that the target class is already mapped. This behavior
differed from that of the_orm.mapper()
function which does report an
informative message already.References: #7579
-
[orm] [bug] [asyncio] Added missing method
_asyncio.AsyncSession.invalidate()
to the
_asyncio.AsyncSession
class.References: #7524
-
[orm] [bug] [regression] Fixed regression which appeared in 1.4.23 which could cause loader options
to be mis-handled in some cases, in particular when using joined table
inheritance in combination with thepolymorphic_load="selectin"
option
as well as relationship lazy loading, leading to aTypeError
.References: #7557
-
[orm] [bug] [regression] Fixed ORM regression where calling the
_orm.aliased()
function
against an existing_orm.aliased()
construct would fail to produce
correct SQL if the existing construct were against a fixed table. The fix
allows that the original_orm.aliased()
construct is disregarded if
it were only against a table that's now being replaced. It also allows for
correct behavior when constructing a_orm.aliased()
without a
selectable argument against a_orm.aliased()
that's against a
subuquery, to create an alias of that subquery (i.e. to change its name).The nesting behavior of
_orm.aliased()
remains in place for the case
where the outer_orm.aliased()
object is against a subquery which in
turn refers to the inner_orm.aliased()
object. This is a relatively
new 1.4 feature that helps to suit use cases that were previously served by
the deprecatedQuery.from_self()
method.References: #7576
-
[orm] [bug] Fixed issue where
_sql.Select.correlate_except()
method, when passed
either theNone
value or no arguments, would not correlate any elements
when used in an ORM context (that is, passing ORM entities as FROM
clauses), rather than causing all FROM elements to be considered as
"correlated" in the same way which occurs when using Core-only constructs.References: #7514
-
[orm] [bug] [regression] Fixed regression from 1.3 where the "subqueryload" loader strategy would
fail with a stack trace if used against a query that made use of
_orm.Query.from_statement()
or_sql.Select.from_statement()
. As
subqueryload requires modifying the original statement, it's not compatible
with the "from_statement" use case, especially for statements made against
the_sql.text()
construct. The behavior now is equivalent to that of
1.3 and previously, which is that the loader strategy silently degrades to
not be used for such statements, typically falling back to using the
lazyload strategy.References: #7505
sql
-
[sql] [bug] [postgresql] Added additional rule to the system that determines
TypeEngine
implementations from Python literals to apply a second level of adjustment
to the type, so that a Python datetime with or without tzinfo can set the
timezone=True
parameter on the returnedDateTime
object, as
well asTime
. This helps with some round-trip scenarios on
type-sensitive PostgreSQL dialects such as asyncpg, psycopg3 (2.0 only).References: #7537
-
[sql] [bug] Added an informative error message when a method object is passed to a SQL
construct. Previously, when such a callable were passed, as is a common
typographical error when dealing with method-chained SQL constructs, they
were interpreted as "lambda SQL" targets to be invoked at compilation time,
which would lead to silent failures. As this feature was not intended to be
used with methods, method objects are now rejected.References: #7032
mypy
-
[mypy] [bug] Fixed Mypy crash when running id daemon mode caused by a
missing attribute on an internal mypyVar
instance.References: #7321
asyncio
-
[asyncio] [usecase] Added new method
AdaptedConnection.run_async()
to the DBAPI
connection interface used by asyncio drivers, which allows methods to be
called against the underlying "driver" connection directly within a
sync-style function where theawait
keyword can't be used, such as
within SQLAlchemy event handler functions. The method is analogous to the
_asyncio.AsyncConnection.run_sync()
method which translates
async-style calls to sync-style. The method is useful for things like
connection-pool on-connect handlers that need to invoke awaitable methods
on the driver connection when it's first created.References: #7580
postgresql
-
[postgresql] [usecase] Added string rendering to the
postgresql.UUID
datatype, so that
stringifying a statement with "literal_binds" that uses this type will
render an appropriate string value for the PostgreSQL backend. Pull request
courtesy José Duarte.References: #7561
-
[postgresql] [bug] [asyncpg] Improved support for asyncpg handling of TIME WITH TIMEZONE, which
was not fully implemented.References: #7537
-
[postgresql] [bug] [mssql] [reflection] Fixed reflection of covering indexes to report
include_columns
as part
of thedialect_options
entry in the reflected index dictionary, thereby
enabling round trips from reflection->create to be complete. Included
columns continue to also be present under theinclude_columns
key for
backwards compatibility.References: #7382
-
[postgresql] [bug] Fixed handling of array of enum values which require escape characters.
References: #7418
mysql
-
[mysql] [change] Replace
SHOW VARIABLES LIKE
statement with equivalent
SELECT @@variable
in MySQL and MariaDB dialect initialization.
This should avoid mutex contention caused bySHOW VARIABLES
,
improving initialization performance.References: #7518
-
[mysql] [bug] Removed unnecessary dependency on PyMySQL from the asyncmy dialect. Pull
request courtesy long2ice.References: #7567