]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
automatically create proxy col for already-used col in values
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 25 Aug 2023 14:48:59 +0000 (10:48 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 29 Aug 2023 17:18:38 +0000 (13:18 -0400)
commitd1c6617a22d1cb1887245c9b5182ee289871483c
tree489e4f67a1ee986e9da9f801fc18de733ec365fa
parent7cf836241aa72494b42b645a3ddec04b0a6e6061
automatically create proxy col for already-used col in values

The :class:`.Values` construct will now automatically create a proxy (i.e.
a copy) of a :class:`_sql.column` if the column were already associated
with an existing FROM clause.  This allows that an expression like
``values_obj.c.colname`` will produce the correct FROM clause even in the
case that ``colname`` was passed as a :class:`_sql.column` that was already
used with a previous :class:`.Values` or other table construct.
Originally this was considered to be a candidate for an error condition,
however it's likely this pattern is already in widespread use so it's
now added to support.

* adjust unrelated dml test recently added for update..returning *
  case to not rely upon ordering

Fixes: #10280
Change-Id: I6e60e5b7cb7abd6a7bbd4722970ebf025596ab9c
doc/build/changelog/unreleased_20/10280.rst [new file with mode: 0644]
lib/sqlalchemy/sql/selectable.py
test/orm/dml/test_update_delete_where.py
test/sql/test_values.py