1.4.20
Released: June 28, 2021
orm
-
[orm] [bug] [regression] Fixed regression in ORM regarding an internal reconstitution step for the
_orm.with_polymorphic()
construct, when the user-facing object is
garbage collected as the query is processed. The reconstitution was not
ensuring the sub-entities for the "polymorphic" case were handled, leading
to anAttributeError
.References: #6680
-
[orm] [bug] [regression] Adjusted
_orm.Query.union()
and similar set operations to be
correctly compatible with the new capabilities just added in
#6661, with SQLAlchemy 1.4.19, such that the SELECT statements
rendered as elements of the UNION or other set operation will include
directly mapped columns that are mapped as deferred; this both fixes a
regression involving unions with multiple levels of nesting that would
produce a column mismatch, and also allows the_orm.undefer()
option
to be used at the top level of such a_orm.Query
without having to
apply the option to each of the elements within the UNION.References: #6678
-
[orm] [bug] Adjusted the check in the mapper for a callable object that is used as a
@validates
validator function or a@reconstructor
reconstruction
function, to check for "callable" more liberally such as to accommodate
objects based on fundamental attributes like__func__
and
__call___
, rather than testing forMethodType
/FunctionType
,
allowing things like cython functions to work properly. Pull request
courtesy Miłosz Stypiński.References: #6538
engine
-
[engine] [bug] Fixed an issue in the C extension for the
_result.Row
class which
could lead to a memory leak in the unlikely case of a_result.Row
object which referred to an ORM object that then was mutated to refer back
to theRow
itself, creating a cycle. The Python C APIs for tracking GC
cycles has been added to the native_result.Row
implementation to
accommodate for this case.References: #5348
-
[engine] [bug] Fixed old issue where a
_sql.select()
made against the token "*",
which then yielded exactly one column, would fail to correctly organize the
cursor.description
column name into the keys of the result object.References: #6665
sql
-
[sql] [usecase] Add a impl parameter to
_types.PickleType
constructor, allowing
any arbitary type to be used in place of the default implementation of
_types.LargeBinary
. Pull request courtesy jason3gb.References: #6646
-
[sql] [bug] [orm] Fixed the class hierarchy for the
_schema.Sequence
and the more
general_schema.DefaultGenerator
base, as these are "executable"
as statements they need to include_sql.Executable
in their
hierarchy, not just_roles.StatementRole
as was applied
arbitrarily to_schema.Sequence
previously. The fix allows
_schema.Sequence
to work in all.execute()
methods including
with_orm.Session.execute()
which was not working in the case that a
_orm.SessionEvents.do_orm_execute()
handler was also established.References: #6668
schema
-
[schema] [bug] Fixed issue where passing
None
for the value of
_schema.Table.prefixes
would not store an empty list, but
rather the constantNone
, which may be unexpected by third party
dialects. The issue is revealed by a usage in recent versions of Alembic
that are passingNone
for this value. Pull request courtesy Kai
Mueller.References: #6685
mysql
-
[mysql] [usecase] Made a small adjustment in the table reflection feature of the MySQL
dialect to accommodate for alternate MySQL-oriented databases such as TiDB
which include their own "comment" directives at the end of a constraint
directive within "CREATE TABLE" where the format doesn't have the
additional space character after the comment, in this case the TiDB
"clustered index" feature. Pull request courtesy Daniël van Eeden.References: #6659
misc
-
[bug] [ext] [regression] Fixed regression in
sqlalchemy.ext.automap
extension such that the
use case of creating an explicit mapped class to a table that is also the
_orm.relationship.secondary
element of a
_orm.relationship()
that automap will be generating would emit the
"overlaps" warnings introduced in 1.4 and discussed aterror_qzyx
.
While generating this case from automap is still subject to the same
caveats that the "overlaps" warning refers towards, as automap is intended
for more ad-hoc use cases, the condition which produces the warning is
disabled when a many-to-many relationship with this particular pattern is
generated.References: #6679