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

Reply via email to