From 0df977ccad63831375d8a7bc6383385c331d9742 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 24 Jul 2014 14:33:50 -0400 Subject: - Added a supported :meth:`.FunctionElement.alias` method to functions, e.g. the ``func`` construct. Previously, behavior for this method was undefined. The current behavior mimics that of pre-0.9.4, which is that the function is turned into a single-column FROM clause with the given alias name, where the column itself is anonymously named. fixes #3137 --- lib/sqlalchemy/sql/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql/base.py') diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py index 5358d95b5..2d06109b9 100644 --- a/lib/sqlalchemy/sql/base.py +++ b/lib/sqlalchemy/sql/base.py @@ -449,10 +449,12 @@ class ColumnCollection(util.OrderedProperties): """ - def __init__(self): + def __init__(self, *columns): super(ColumnCollection, self).__init__() self.__dict__['_all_col_set'] = util.column_set() self.__dict__['_all_columns'] = [] + for c in columns: + self.add(c) def __str__(self): return repr([str(c) for c in self]) -- cgit v1.2.1