executemany & UPDATE (MySQL & Python)

Gerhard Häring gerhard at bigfoot.de
Fri Jun 14 15:17:51 EDT 2002


(Cc-ing Andy Dustman)

* Nick Arnett <narnett at mccmedia.com> [2002-06-14 11:02 -0700]:
> > Gerhard wrote:
> > > Nick Arnett wrote:
> > > > Can anyone confirm that it is *not* possible to pass a list to
> > > > the Python MySQLdb module in UPDATE operations?

...

> > For database modules that don't support prepared statements, the db module
> > implements executemany with multiple calls to execute, anyway.
> 
> Well, since MySQLdb is much faster at inserting that way, I'm assuming that
> if it'll do it on an UPDATE, that will also be much faster.

I mistakenly assumed that MySQLdb's executemany was implemented the same
way as pyPgSQL's. That assumption was wrong. Looking into the source
reveals that MySQLdb's implementation is really clever, but
unfortunately hardcoded to only work with INSERT statements.

Gerhard
-- 
This sig powered by Python!
Außentemperatur in München: 24.3 °C      Wind: 1.9 m/s





More information about the Python-list mailing list