]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Allow duplicate columns in from clauses and selectables
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 7 Jul 2019 15:12:31 +0000 (11:12 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 11 Jul 2019 18:20:10 +0000 (14:20 -0400)
commitaceefb508ccd0911f52ff0e50324b3fefeaa3f16
treee57124d3ea8b0e2cd7fe1d3ad22170fa956bcafb
parent5c16367ee78fa1a41d6b715152dcc58f45323d2e
Allow duplicate columns in from clauses and selectables

The :func:`.select` construct and related constructs now allow for
duplication of column labels and columns themselves in the columns clause,
mirroring exactly how column expressions were passed in.   This allows
the tuples returned by an executed result to match what was SELECTed
for in the first place, which is how the ORM :class:`.Query` works, so
this establishes better cross-compatibility between the two constructs.
Additionally, it allows column-positioning-sensitive structures such as
UNIONs (i.e. :class:`.CompoundSelect`) to be more intuitively constructed
in those cases where a particular column might appear in more than one
place.   To support this change, the :class:`.ColumnCollection` has been
revised to support duplicate columns as well as to allow integer index
access.

Fixes: #4753
Change-Id: Ie09a8116f05c367995c1e43623c51e07971d3bf0
20 files changed:
doc/build/changelog/migration_14.rst
doc/build/changelog/unreleased_14/4753.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/oracle/base.py
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/sql/base.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/dml.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/functions.py
lib/sqlalchemy/sql/schema.py
lib/sqlalchemy/sql/selectable.py
test/base/test_utils.py
test/engine/test_reflection.py
test/profiles.txt
test/sql/test_compiler.py
test/sql/test_cte.py
test/sql/test_join_rewriting.py
test/sql/test_metadata.py
test/sql/test_selectable.py