[Twisted-web] database best practices
bernat at luffy.cx
Tue Nov 25 04:18:48 EST 2008
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 separate
thread and in a transaction.
More information about the Twisted-web