[Twisted-Python] Deferred database transaction confusion

Itamar Shtull-Trauring itamar at itamarst.org
Wed Aug 13 13:26:24 EDT 2003


On Wed, 13 Aug 2003 10:18:07 -0700
"Lucas Taylor" <lucas at lucaserve.com> wrote:

> selectCustomer
> (do some work)
> updateCustomer
> updateBalance
> (do some more work)
> insertTxTable

do it in a runInteraction, which is the span of a single transaction,
and lets you do multiple operations. And you can use
reactor.callFromThread to communicate with the main reactor thread.

> Maybe what I'll have to do is keep track of every db update/insert and
> have corresponding balancing procedures so that I can do a manual
> rollback

Eeew, no, don't do that. Worst case roll your own database interaction
code using the threading support, you don't have to use
twisted.enterprise if it doesn't make sense.

-- 
Itamar Shtull-Trauring    http://itamarst.org/
Available for Python & Twisted consulting




More information about the Twisted-Python mailing list