diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2022-09-20 02:34:31 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2022-09-20 02:34:31 +0000 |
commit | 214d1ad7c38deebec6547da22b99c0a4804bf820 (patch) | |
tree | 730b18fefc3dfd0ca4c39ef20c14c0e9fec0eb68 /lib/sqlalchemy/sql | |
parent | aab6005dda456c8647192cd62064c67e6a5558ff (diff) | |
parent | c9af2ebf5e5d288aea3a3a26bdf950e08ac4f927 (diff) | |
download | sqlalchemy-214d1ad7c38deebec6547da22b99c0a4804bf820.tar.gz |
Merge "break out text() from TextualSelect for col matching" into main
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 45b5eab56..1d13ffa9a 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -838,6 +838,20 @@ class SQLCompiler(Compiled): _textual_ordered_columns: bool = False """tell the result object that the column names as rendered are important, but they are also "ordered" vs. what is in the compiled object here. + + As of 1.4.42 this condition is only present when the statement is a + TextualSelect, e.g. text("....").columns(...), where it is required + that the columns are considered positionally and not by name. + + """ + + _ad_hoc_textual: bool = False + """tell the result that we encountered text() or '*' constructs in the + middle of the result columns, but we also have compiled columns, so + if the number of columns in cursor.description does not match how many + expressions we have, that means we can't rely on positional at all and + should match on name. + """ _ordered_columns: bool = True @@ -3592,7 +3606,7 @@ class SQLCompiler(Compiled): ) -> None: if keyname is None or keyname == "*": self._ordered_columns = False - self._textual_ordered_columns = True + self._ad_hoc_textual = True if type_._is_tuple_type: raise exc.CompileError( "Most backends don't support SELECTing " |