]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
generalize adapt_on_names to expect non-named elements
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 10 Feb 2023 13:39:21 +0000 (08:39 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 10 Feb 2023 15:42:11 +0000 (10:42 -0500)
commiteb0861e8e69f8ce702301c558e552e1aeb2e9eba
tree638c8a08641e524b3ed54ee824275e5eb520ecbe
parent48aad8b244737ad7d2000056ce7320d6b32fa2de
generalize adapt_on_names to expect non-named elements

The fix in #9217 opened up adapt_on_names to more kinds of
expressions than it was prepared for; adjust that logic
and also refine in the ORM where we are using it, as we
dont need it (yet) for the DML RETURNING use case.

Fixed regression introduced in version 2.0.2 due to :ticket:`9217` where
using DML RETURNING statements, as well as
:meth:`_sql.Select.from_statement` constructs as was "fixed" in
:ticket:`9217`, in conjunction with ORM mapped classes that used
expressions such as with :func:`_orm.column_property`, would lead to an
internal error within Core where it would attempt to match the expression
by name. The fix repairs the Core issue, and also adjusts the fix in
:ticket:`9217` to not take effect for the DML RETURNING use case, where it
adds unnecessary overhead.

Fixes: #9273
Change-Id: Ie0344efb12ff7df48f21e71e62dc598c76a6a0de
doc/build/changelog/unreleased_20/9273.rst [new file with mode: 0644]
lib/sqlalchemy/orm/bulk_persistence.py
lib/sqlalchemy/orm/context.py
lib/sqlalchemy/sql/util.py
test/orm/dml/test_bulk_statements.py
test/orm/test_froms.py
test/sql/test_external_traversal.py