[DB-SIG] PySQL/insert a list of tuples....

Marcos Sánchez Provencio msanchez@grupoburke.com
22 Aug 2002 18:35:37 +0200


El jue, 22-08-2002 a las 15:10, Denis Cartier Millon escribió:
> I  want insert a sequence of sequence (list og tuples) in a table ,
> (x comme from the script select * from Mytable with an fethchall)
> 
> and the script is :
> cur=conn.cursor()
> cur.executemany("insert into Mytable values (%s)",x) # is there a 
> solution thanks.....
> 
Is there a problem?

But seriously, you have to give as many %s as column values you want
inserted in your sql 

cur.executemany("insert into Mytable (col1,col2,col3) values
(%s,%s,%s)",x)