[Twisted-Python] fetchmany and deferreds which call back more than once

Clark C. Evans cce at clarkevans.com
Mon Mar 3 19:15:37 EST 2003

I have a result set with potentially 100's (1000's or more) 
of rows from a database that I need to stream back to the 
client after HTML formatting.  Anyway, I've looked at the
enterprise adapter, and it only returns "once" for a given
query with the return value of fetchall() of the cursor.
While this is interesting, what I'd really like is a way
to pass "chunks" of the result back via fetchmany(). 
I'm kinda stumped as to where to begin, I've gone through
much of the database adapter and threading and deferred
code but don't quite know where to start.

On a related item, some database adapters (pypgsql) have
a non-blocking execute so that you can pool for results
instead of blocking.  I was wondering how the above 
"producer" mechanism could be used without requiring
threads (via pooling now and again).



More information about the Twisted-Python mailing list