How about this: def min(self, col): """executes the SQL min() function against the given column""" s1 = sql.select([col], self._clause, **self._ops).alias('u') s2 = sql.select([sql.func.min(getattr(s1.c,col.name))]).scalar() return s2
Randall Michael Bayer wrote: > in not really sure if the aggregate functions in SelectResults should > convert everything to a subquery first, then call the aggrgate on > that; SelectResults is based on people's desire for a particular > functionality they missed from SQLObject (which im not terribly > familiar with), and it was contributed code; as far as I know it > works very similarly to SQLObject. > > such a feature would require a much more complicated SelectResults > implementation though, it would probably have to re-implement some of > the functionality within Query to re-create the full query as a > subquery and operate upon that. right now its just a very simple > wrapper and doesnt deal with the details of constructing the mapper's > queries. Also the aggregate functions take a Column object as the > argument, so that would have to be mapped out to the corresponding > Column on the subquery object for it to work (selectables do support > this operation). > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users