On Thu, Apr 24, 2008 at 04:17:02AM -0700, Geoff wrote:
> Is it possible to use MySQL server side cursors in SQLAlchemy?
> 
> Alternatively does anyone have any suggestions for doing paging? I
> want to know the total results for a particular query but I only want
> to actually get a subset. I need the total so I can display page
> numbers...

This is easy!  If you've got a query object q:

q.count() - returns the count of elements matching the query
q[a:b] - returns a slice of the data set via limit/offset

Also check out the paginate module in the new WebHelpers.  I haven't
converted any apps to it from my old paging code, but if I was
starting now, I would use it.

-- 
Ross Vandegrift
[EMAIL PROTECTED]

"The good Christian should beware of mathematicians, and all those who
make empty prophecies. The danger already exists that the mathematicians
have made a covenant with the devil to darken the spirit and to confine
man in the bonds of Hell."
        --St. Augustine, De Genesi ad Litteram, Book II, xviii, 37

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to