On Sat, 2008-12-06 at 04:03 -0800, [EMAIL PROTECTED] wrote: > 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!
You want to use the cursor's .executemany() method. > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list