[sqlalchemy] Re: Bug with order_by and certain versions of mysql

2007-04-29 Thread Michael Bayer
On Apr 29, 2007, at 8:11 PM, Ram Yalamanchili wrote: > objects i believe. So, still trying to see how to fit what you said > into my query like: > > > q = Query(cls).join('parent').group_by(cls.c.user_id).order_by > (func.count(cls.c.user_id)).limit(limit).offset(offset) > thatll work, have yo

[sqlalchemy] Re: Bug with order_by and certain versions of mysql

2007-04-29 Thread Ram Yalamanchili
Hi, But, how do i insert the func.count(x).label('whatever') into a Query(User) ? User is an assign_mapper based obj. I dont think i can use Select([func.count(x)]).query() since that wont return a list User objects i believe. So, still trying to see how to fit what you said into my query like:

[sqlalchemy] Re: Bug with order_by and certain versions of mysql

2007-04-29 Thread Michael Bayer
On Apr 29, 2007, at 1:07 AM, Ram Yalamanchili wrote: > > 1) select a func.count() column > 2) Name an alias to it > 3) use this alias with a .order_by > func.count(x).label('whatever') then order_by('whatever') (or order_by=['whatever'], depending on context) --~--~-~--~~--