Hi ,

my purpose is a generic insert via  tuple , because the number of fields and 
can differ. But  I'm stucking .

ilist=['hello',None,7,None,None]

#This version works, but all varchar fields are in extra '' enclosed.
con.execute(""" INSERT INTO {} VALUES %r; """.format(table) , (tuple(ilist),))

#This produce (1054, "Unknown column 'None' in 'field list'"),
#but without None values it works.
con.execute(""" INSERT INTO {} VALUES %r; """.format(table) % (tuple(ilist),))


Many thanks,
Christian


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to