SamDonaldson wrote:
> 
> I haven't been able to find an answer to this anywhere but how does
> one run a mysql range type query where you have a LIMIT a, b?

You can have the query printed by either adding "&debug=true" to your connection
string or by: (which is very handy at the shell)
    Contact._connection.debug = True

Let's say you have an address book with Contact as model:
    prq = Contact.select(Contact.q.last_name.startswith('Don'))
This won't actually execute the query but return something SQLObject will work 
with.

Now to your question, let's fetch some Contacts (with your a and b):
    myList = prq[a:b]
Voila!

And, don't do this as it will yield in a query every iteration:
    for person in prq:             # bad!
        ...
Better, fetch all the results at once by:
    for person in prq[:]:          # good!
        ...
or:
    for person in list(prq):
        ...

-- W-Mark Kubacki

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to