[Twisted-Python] Is there twisted.enterprise.adbapi support for .executemany()?
Phil Christensen
phil at bubblehouse.org
Tue Apr 15 13:08:47 MDT 2008
On Apr 15, 2008, at 2:55 PM, Nathan wrote:
> Does anyone know of any (possibly experimental)
> twisted.enterprise.adbapi support for .executemany() ?
>
> (see http://www.python.org/dev/peps/pep-0249/ -- search for
> ".executemany")
>
> If not, I'll see if I can't add a runOperationMany() to
> twisted.enterprise.adbapi.ConnectionPool. The functionality I want is
> simple in theory.
It definitely wouldn't be hard to create this function. You could add
it to ConnectionPool, but a subclass would work equally well.
Just take a look at how runOperation works, and create a similar
function, runOperationMany(trans, *args, **kwargs). This should call
runInteraction and pass your second function _runOperationMany(trans,
*args, **kwargs) which uses the `trans` as the cursor object.
Transaction instances like that automatically inherit all the
attributes of the base cursor class in your particular driver, so you
should be able to call executemany() without a problem.
Hope that helps,
-phil
More information about the Twisted-Python
mailing list