On 3/22/06, Michael Bayer <[EMAIL PROTECTED]> wrote:
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

