From bf67069d264cba3feed8a48614289d605ed61a55 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 26 Feb 2014 13:28:14 -0500 Subject: - Fixed issue in new :meth:`.TextClause.columns` method where the ordering of columns given positionally would not be preserved. This could have potential impact in positional situations such as applying the resulting :class:`.TextAsFrom` object to a union. --- lib/sqlalchemy/sql/elements.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 2846b3b51..1b49a7cd1 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -1446,13 +1446,13 @@ class TextClause(Executable, ClauseElement): """ - col_by_name = dict( - (col.key, col) for col in cols - ) - for key, type_ in types.items(): - col_by_name[key] = ColumnClause(key, type_) - - return selectable.TextAsFrom(self, list(col_by_name.values())) + input_cols = [ + ColumnClause(col.key, types.pop(col.key)) + if col.key in types + else col + for col in cols + ] + [ColumnClause(key, type_) for key, type_ in types.items()] + return selectable.TextAsFrom(self, input_cols) @property def type(self): -- cgit v1.2.1