I'm transforming a query from .select(offset=start, limit=rpp) to
.query()[:] syntax.
('rpp' means records per page.) Stupidly I transformed it directly into:
.query()[start:rpp]
which in one transaction evaluates to:
.query()[1420:20]
This causes a SQL syntax error with the actual query containing:
... LIMIT -1400 OFFSET 1420
Apparently a negative limit is illegal in MySQL. Of course I should
have done it this way:
.query()[start:start+rpp]
because the second number is supposed to be one past the last index,
not the number of records to return. This results in a much more
reasonable:
.query()[1420:1440]
... LIMIT 20 OFFSET 1420
My point is, if the second number is lower than the first, shouldn't
SQLAlchemy transform it into a query that returns no records? I.e.,
LIMIT 0, which MySQL at least allows. Because that's what the Python
equivalent would do:
>>> range(9999)[1420:20]
[]
--
Mike Orr <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---