diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2021-06-22 22:05:35 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2021-06-22 22:05:35 +0000 |
commit | 7110a5fa8644b29d35c4c81a1e8f7ebddebc40dc (patch) | |
tree | 45ebf946b3414e45e982cbdf90e9d787de86cdf6 /lib/sqlalchemy/sql/compiler.py | |
parent | a84881e1b7505c3ffb9b9f0ac2b227cbd650aac2 (diff) | |
parent | 2cf8c5868cb83185001755d86aa0f79e0318b53f (diff) | |
download | sqlalchemy-7110a5fa8644b29d35c4c81a1e8f7ebddebc40dc.tar.gz |
Merge "Export deferred columns but not col props; fix CTE labeling"
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 220a0fa99..f47ea8f33 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -2562,18 +2562,20 @@ class SQLCompiler(Compiled): elif isinstance(cte.element, selectable.CompoundSelect): col_source = cte.element.selects[0] else: - assert False + assert False, "cte should only be against SelectBase" recur_cols = [ c for c in util.unique_list( - col_source._exported_columns_iterator() + col_source._all_selected_columns ) if c is not None ] text += "(%s)" % ( ", ".join( - self.preparer.format_column(ident) + self.preparer.format_column( + ident, anon_map=self.anon_map + ) for ident in recur_cols ) ) @@ -5012,11 +5014,18 @@ class IdentifierPreparer(object): name=None, table_name=None, use_schema=False, + anon_map=None, ): """Prepare a quoted column name.""" if name is None: name = column.name + + if anon_map is not None and isinstance( + name, elements._truncated_label + ): + name = name.apply_map(anon_map) + if not getattr(column, "is_literal", False): if use_table: return ( |