diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-03-23 18:53:42 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-03-23 18:53:42 -0400 |
commit | ead3d6ab2fd323dad99c310cab7aa12d72f4f4ee (patch) | |
tree | fe0043432d50f2dc05672fa061501a92ac2e2877 /lib/sqlalchemy/orm/query.py | |
parent | 4d396e5ff0ea111c81605527d415b251d73629f7 (diff) | |
download | sqlalchemy-ead3d6ab2fd323dad99c310cab7aa12d72f4f4ee.tar.gz |
- added add_columns() to Query - pending deprecates add_column()
- refined subquery strategy to use more public Query API
Diffstat (limited to 'lib/sqlalchemy/orm/query.py')
-rw-r--r-- | lib/sqlalchemy/orm/query.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index 2dfefc433..5e7a2028e 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -662,16 +662,25 @@ class Query(object): return None @_generative() - def add_column(self, column): - """Add a SQL ColumnElement to the list of result columns to be returned.""" + def add_columns(self, *column): + """Add one or more column expressions to the list + of result columns to be returned.""" self._entities = list(self._entities) l = len(self._entities) - _ColumnEntity(self, column) + for c in column: + _ColumnEntity(self, c) # _ColumnEntity may add many entities if the # given arg is a FROM clause self._setup_aliasizers(self._entities[l:]) + @util.pending_deprecation("add_column() superceded by add_columns()") + def add_column(self, column): + """Add a column expression to the list of result columns + to be returned.""" + + return self.add_columns(column) + def options(self, *args): """Return a new Query object, applying the given list of MapperOptions. |