]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
render select froms first
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 20 May 2022 19:56:54 +0000 (15:56 -0400)
committermike bayer <mike_mp@zzzcomputing.com>
Sun, 22 May 2022 19:24:18 +0000 (19:24 +0000)
commitfbdf8251924571add5478e9ee5a915316a7baa11
treee9cc3e164322bfaf7496425f6c2bc6b2d947015b
parent0620614f95f62f35396e63c636cae98a0759f3ab
render select froms first

The FROM clauses that are established on a :func:`_sql.select` construct
when using the :meth:`_sql.Select.select_from` method will now render first
in the FROM clause of the rendered SELECT, which serves to maintain the
ordering of clauses as was passed to the :meth:`_sql.Select.select_from`
method itself without being affected by the presence of those clauses also
being mentioned in other parts of the query. If other elements of the
:class:`_sql.Select` also generate FROM clauses, such as the columns clause
or WHERE clause, these will render after the clauses delivered by
:meth:`_sql.Select.select_from` assuming they were not explictly passed to
:meth:`_sql.Select.select_from` also. This improvement is useful in those
cases where a particular database generates a desirable query plan based on
a particular ordering of FROM clauses and allows full control over the
ordering of FROM clauses.

Fixes: #7888
Change-Id: I740f262a3841f829239011120a59b5e58452db5b
17 files changed:
doc/build/changelog/unreleased_20/7888.rst [new file with mode: 0644]
lib/sqlalchemy/sql/selectable.py
test/ext/test_associationproxy.py
test/orm/inheritance/test_polymorphic_rel.py
test/orm/inheritance/test_relationship.py
test/orm/test_core_compilation.py
test/orm/test_deprecations.py
test/orm/test_dynamic.py
test/orm/test_froms.py
test/orm/test_joins.py
test/orm/test_query.py
test/orm/test_relationships.py
test/sql/test_compiler.py
test/sql/test_external_traversal.py
test/sql/test_functions.py
test/sql/test_selectable.py
test/sql/test_text.py