Insert Multiple Records Using One Insert Statemen with MySQLdb module
anton.ranieri.it at gmail.com
anton.ranieri.it at gmail.com
Sat Dec 6 07:03:04 EST 2008
Hi,
I'd like to insert Multiple Records Using One Insert Statement
inserting one record using one insert statement works
this is the example:
import MySQLdb
conn = MySQLdb.connect(host="localhost",.....)
cursore = conn.cursor()
cursore.execute('INSERT INTO frutta (nome, quantita) VALUES(%s, %s)',
('Pompelmi', 10)
)
but when I try to insert Multiple Records Using One Insert Statement
in this way:
cursore.execute('INSERT INTO frutta (nome, quantita) VALUES(%s, %s)',
('Pompelmi', 10),
('Pompelmi', 10),
('Pompelmi', 10)
)
it doesn't work!
Antonella
More information about the Python-list
mailing list