[sqlalchemy] Re: problem with join, count on 0.5.0rc3

2008-11-10 Thread Cito
The new behavior is exactly what I expect, namely that query.count() returns the same as len(query.all()). Are there cases in which this does not make sense or where this would not work? -- Christoph --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] Re: problem with join, count on 0.5.0rc3

2008-11-10 Thread Michael Bayer
it should be fine. On Nov 10, 2008, at 6:34 AM, Cito wrote: The new behavior is exactly what I expect, namely that query.count() returns the same as len(query.all()). Are there cases in which this does not make sense or where this would not work? -- Christoph

[sqlalchemy] Re: problem with join, count on 0.5.0rc3

2008-11-09 Thread Cito
On 8 Nov., 22:03, Michael Bayer [EMAIL PROTECTED] 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() This question is actually coming from the TurboGears group. The problem

[sqlalchemy] Re: problem with join, count on 0.5.0rc3

2008-11-09 Thread Michael Bayer
On Nov 9, 2008, at 4:46 AM, Cito wrote: On 8 Nov., 22:03, Michael Bayer [EMAIL PROTECTED] 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() This question is actually

[sqlalchemy] Re: problem with join, count on 0.5.0rc3

2008-11-09 Thread Michael Bayer
On Nov 9, 2008, at 9:39 AM, Michael Bayer wrote: On Nov 9, 2008, at 4:46 AM, Cito wrote: On 8 Nov., 22:03, Michael Bayer [EMAIL PROTECTED] wrote: oh sorry, also count() is meant to count instances of a single kind of object. So in fact you should be saying:

[sqlalchemy] Re: problem with join, count on 0.5.0rc3

2008-11-08 Thread Michael Bayer
it doesn't know which class on the left side you'd like to join from. so its looking for: sess.query(A, B, C).join((B, A.bs), (C, B.cs)) alternatively, instead of A.bs etc. you can spell out the join condition such as A.b_id==B.id in each tuple. On Nov 8, 2008, at 3:03 PM, Greg wrote:

[sqlalchemy] Re: problem with join, count on 0.5.0rc3

2008-11-08 Thread Michael Bayer
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

[sqlalchemy] Re: problem with join, count on 0.5.0rc3

2008-11-08 Thread Michael Bayer
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