[Twisted-web] database best practices
abdulwahid at gmail.com
Tue Nov 25 04:30:30 EST 2008
I thought the twisted enterprise was meant to be more suited...
(Sorry Martin for hijacking your question but I think we want to know the
same thing). Anyway, the method on this page sounds good but I wasn't
actually sure how I fit this in with the renderers. Especially, there are
some SQL queries I want to do before rendering anything on the page and
perhaps before even sending HTTP header information. If I am calling the
deffered from renderHTTP how do I use the result within renderHTTP.
An example would be nice :)
On Tue, Nov 25, 2008 at 12:18 PM, Vincent Bernat <bernat at luffy.cx> wrote:
> On Tue, 25 Nov 2008 00:28:21 -0500, "Martin Bright"
> <Martin.Bright at casero.com> wrote:
> > What is the best way to implement synchronous DB access in a twisted
> > application? I've read about defer.deferredGenerator, and various
> > about how it's a stupid idea to even attempt this. Do I have restructure
> > code such that everything that depends on results from a database query
> > in a callback to a deferred object?
> You can use runInteraction(). This will execute your DB query in a separa=
> thread and in a transaction.
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-web