[Twisted-Python] Deferred database transaction confusion

Lucas Taylor lucas at lucaserve.com
Wed Aug 13 13:18:07 EDT 2003

OK, I receive a response from my interaction, and it will have been
committed if no exceptions occurred. Does this mean I have no way of
controlling the commit/rollback behavior? How would you wrap a series of
transactions that relied on each other?
Say I have a series of db work that needs to be done, like:

(do some work)
(do some more work)

Ignoring the fact that I don't want to commit any of these transactions
until I rx a response from the client, how would I treat these as
atomic? I don't want the updates to actually commit until the insert is
complete into the TxTable. I guess I could move a lot of the logic to a
single stored procedure if it's going to be committed on execution
before the client actually receives the results. But that's no fun.

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


Lucas Taylor

----- Original Message -----
From: "Itamar Shtull-Trauring" <itamar at itamarst.org>
To: <twisted-python at twistedmatrix.com>
Sent: Wednesday, August 13, 2003 5:23 AM
Subject: Re: [Twisted-Python] Deferred database transaction confusion

> You don't. The commit/rollback happens before the Deferred's callbacks
> get called. In fact, the commit/rollback are done for you
> - if you runInteraction the operations you did will be committed if
> succeeded or rolled back if an exception was raised in the interaction
> function.
> --
> Itamar Shtull-Trauring    http://itamarst.org/
> Available for Python & Twisted consulting

More information about the Twisted-Python mailing list