here's the new error message in the latest trunk: InvalidRequestError: Can't issue count() for multiple types of objects or columns. Construct the Query against a single element as the thing to be counted, or for an actual row count use Query(func.count(somecolumn)) or query.values(func.count(somecolumn)) instead.
On Nov 8, 2008, at 4:03 PM, Michael Bayer wrote: > > oh sorry, also count() is meant to count instances of a single kind of > object. So in fact you should be saying: > > session.query(UserRss).join(Rss, item).count() > > > On Nov 8, 2008, at 3:03 PM, Greg wrote: > >> >> >> This following request works fine and produce the result I was >> expecting session.query(UserRss, Rss, Item).join([Rss, Item]). But >> count doesn't work. Is it a bug, or did I miss something ? >> >>>>> str(session.query(UserRss, Rss, Item).join([Rss, Item]).count()) >> >> Traceback (most recent call last): >> File "<console>", line 1, in <module> >> File "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3- >> py2.5.egg/sqlalchemy/orm/query.py", line 1251, in count >> return self._col_aggregate(sql.literal_column('1'), >> sql.func.count, >> nested_cols=list(self._only_mapper_zero().primary_key)) >> File "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3- >> py2.5.egg/sqlalchemy/orm/query.py", line 241, in _only_mapper_zero >> raise sa_exc.InvalidRequestError("This operation requires a Query >> against a single mapper.") >> InvalidRequestError: This operation requires a Query against a single >> mapper. >> >> Thanks. >> Greg >> >> >>> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---