2 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: MySQL Server Side Cu...
FromSent OnAttachments
Geoff24 Apr 2008 04:16 
Ross Vandegrift25 Apr 2008 08:49 
Subject:[sqlalchemy] Re: MySQL Server Side Cursors
From:Ross Vandegrift (ro@kallisti.us)
Date:04/25/2008 08:49:55 AM
List:com.googlegroups.sqlalchemy

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.

"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