]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
support stringify for plain CTE
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 27 Feb 2021 17:48:54 +0000 (12:48 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 27 Feb 2021 17:49:31 +0000 (12:49 -0500)
commit0c31059a1d6303d2d16b59eb6a5c2c751acdf14a
tree2c2f51d9b72714da076521932f57735dca02caa5
parentdc615763d39916e9c037c7c376db1817cdf02764
support stringify for plain CTE

Altered the compilation for the :class:`.CTE` construct so that a string is
returned representing the inner SELECT statement if the :class:`.CTE` is
stringified directly, outside of the context of an enclosing SELECT; This
is the same behavior of :meth:`_FromClause.alias` and
:meth:`_SelectStatement.subquery`. Previously, a blank string would be
returned as the CTE is normally placed above a SELECT after that SELECT has
been generated, which is generally misleading when debugging.

Change-Id: Id3007c28e4a7a56d867e850bb890752946bd8f6f
References: #5988
doc/build/changelog/unreleased_14/cte_str.rst [new file with mode: 0644]
lib/sqlalchemy/sql/compiler.py
test/sql/test_compiler.py