summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-02-26 13:28:14 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2014-02-26 13:28:14 -0500
commitbf67069d264cba3feed8a48614289d605ed61a55 (patch)
tree3101f06439d9c9ab6a3f7dee1ab48cc5707d6f16 /lib/sqlalchemy/sql
parent6fadb57165248e7142ba8b4d1f3e32fa77054528 (diff)
downloadsqlalchemy-bf67069d264cba3feed8a48614289d605ed61a55.tar.gz
- 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.
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/elements.py14
1 files changed, 7 insertions, 7 deletions
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):