March 2003
Intermediate to advanced
656 pages
39h 30m
English
executemany
c.executemany(statement,*parameters)
Executes a SQL
statement on the database, once for each
item of the given parameters.
parameters is a sequence of sequences when
the module’s paramstyle is
'format', 'numeric', or
'qmark', and a sequence of dictionaries when
'named' or 'pyformat‘. For
example, the statement:
c.executemany('UPDATE atable SET x=? WHERE y=?',
(12,23),(23,34))that uses a module whose paramstyle is
'qmark' is equivalent to, but probably faster
than, the two statements:
c.execute('UPDATE atable SET x=12 WHERE y=23')
c.execute('UPDATE atable SET x=23 WHERE y=34')Read now
Unlock full access