diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-11-07 18:40:03 -0500 |
---|---|---|
committer | mike bayer <mike_mp@zzzcomputing.com> | 2022-11-11 16:20:00 +0000 |
commit | 8e91cfe529b9b0150c16e52e22e4590bfbbe79fd (patch) | |
tree | dc8328ae669164a8fe7cf9c8a821ba92a9057921 /lib/sqlalchemy/sql/selectable.py | |
parent | e3a8d198917f4246365e09fa975d55c64082cd2e (diff) | |
download | sqlalchemy-8e91cfe529b9b0150c16e52e22e4590bfbbe79fd.tar.gz |
establish consistency for RETURNING column labels
The RETURNING clause now renders columns using the routine as that of the
:class:`.Select` to generate labels, which will include disambiguating
labels, as well as that a SQL function surrounding a named column will be
labeled using the column name itself. This is a more comprehensive change
than a similar one made for the 1.4 series that adjusted the function label
issue only.
includes 1.4's changelog for the backported version which also
fixes an Oracle issue independently of the 2.0 series.
Fixes: #8770
Change-Id: I2ab078a214a778ffe1720dbd864ae4c105a0691d
Diffstat (limited to 'lib/sqlalchemy/sql/selectable.py')
-rw-r--r-- | lib/sqlalchemy/sql/selectable.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index 9de015774..488dfe721 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -2193,7 +2193,9 @@ class SelectsRows(ReturnsRows): _label_style: SelectLabelStyle = LABEL_STYLE_NONE def _generate_columns_plus_names( - self, anon_for_dupe_key: bool + self, + anon_for_dupe_key: bool, + cols: Optional[_SelectIterable] = None, ) -> List[_ColumnsPlusNames]: """Generate column names as rendered in a SELECT statement by the compiler. @@ -2204,7 +2206,9 @@ class SelectsRows(ReturnsRows): _column_naming_convention as well. """ - cols = self._all_selected_columns + + if cols is None: + cols = self._all_selected_columns key_naming_convention = SelectState._column_naming_convention( self._label_style |