Is there a way to use the DAL to specify a one-sided limit (aka offset)?

35 views
Skip to first unread message

Brendan Barnwell

unread,
Dec 13, 2017, 4:09:55 AM12/13/17
to web2py-users
I would like to be able to do a query that does something like "give me the rows from the Nth row to the end, no matter how many rows there are".  I can use limitby to get the first N rows, but I can't find a way to say "get all rows except for the first N rows".  This seems especially perverse as the DAL apparently converts a limitby argument to a separate OFFSET and LIMIT, but doesn't seem to provide a separate way to specify an OFFSET alone.  Is there any way to get what I want other than building the query by hand?

Anthony

unread,
Dec 13, 2017, 11:40:18 AM12/13/17
to web2py-users
You'll either have to first retrieve the total record count or just use a number you know will be larger than the record count. Feel free to open an issue in the PyDAL repo.

Note, not all databases support "offset" without "limit".

Anthony

Brendan Barnwell

unread,
Dec 13, 2017, 5:11:02 PM12/13/17
to web2py-users

On Wednesday, December 13, 2017 at 8:40:18 AM UTC-8, Anthony wrote:
You'll either have to first retrieve the total record count or just use a number you know will be larger than the record count. Feel free to open an issue in the PyDAL repo.

Note, not all databases support "offset" without "limit".


Okay, thanks.
Reply all
Reply to author
Forward
0 new messages