[Twisted-Python] PATCH: runQuery

Clark C. Evans cce at clarkevans.com
Thu Mar 6 21:27:31 EST 2003

On Thu, Mar 06, 2003 at 08:02:07PM -0600, Glyph Lefkowitz wrote:
| On Thursday, March 6, 2003, at 07:49 PM, Dave Peticolas wrote:
| >I think you are imposing policy for no reason.
| I think that this is a tough call, although I am very slightly inclined 
| to agree with davep.
| Why don't we make committing an optional argument, by default on, which 
| you can easily turn off if you want a rollback instead?  (At the risk 
| of making an overbroad generalization: rollback() tends to be more 
| expensive than commit() most of the time, which is another good reason 
| to make it the default.)

Typically one would call rollback() before you put 
the connection back into the connection pool.  Overall,
I think there is a lower level design problem with
the adbapi module.  If you are only running one query
then there isn't a rpoblem, but if you are executing
3 queries, say sequentially, then you don't want
that rollback.  The adbapi needs to expose 'connection'
object as a whole, with cursors.   I'll need to fix
this for myself... so if no one else does, I'll patch.

For now, I think rolling back between each query is
good enough... if someone wants to run several queries
in a row, then they really should help me patch.

The other related item is that some databases allow
for multiple cursors with the same connection; and
thus a single request may want to run N deferreds in
parallel (I do, for example) and these deferreds should
all come from the same connection if at all possible.

In short, this is one small issue that needs to be
resolved in that module.



More information about the Twisted-Python mailing list