mapper.select() takes a limit and offset parameter:
http://www.sqlalchemy.org/docs/
adv_datamapping.myt#adv_datamapping_limits
also Ben Bangert I think has some widget hes using with Pylons that
does this same thing with SQLAlchemy in a configurable way.
On Mar 22, 2006, at 3:38 PM, Qvx 3000 wrote:
I'm writing a paginator for my web app. I would like to somehow be
able to construct select statement from inside my controller, and
then later use that select to add limit and offset and to count
total number of records. Currently I can do this:
inside controller:
s = select(Campaign.c)
inside paginator:
s.limit = limit
s.offset = offset
total = s.count().scalar()
rows = s.execute().fetchall()
But the thing is I want to do it with Class/mapper because I want
my objects back not tuples. If I do Campaign.select() it is
immediately executed and fetched.
Currently I have paginator which I ask for limit and offset so I
can explicitly specify it while selecting, but I would like to do
it just like I descibed it a moment ago.
Regards,
Tvrtko
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users