Newbie problem inserting into MySQL

John Machin sjmachin at lexicon.net
Mon Aug 18 16:21:03 EDT 2008


On Aug 19, 1:54 am, len <lsumn... at gmail.com> wrote:

> | lottryid | int(11)             | NO   | PRI | NULL    |
> auto_increment |
>                     tupcnt += 1
>                     rectuple = tupcnt, thekey, a, b, c, d, e, mysum, 0
>                     listofrec.append(rectuple)
>                         cursor.executemany('''insert into
> littlelottery
>                         values (?,?,?,?,?,?,?,?,?)''', listofrec)
>
> i get the following error on insert;
> raise errorclass, errorvalue
> TypeError: not all arguments converted during string formatting

{caveat: I'm not a MySQL user]

Could this be caused by trying to insert a value for an auto_increment
column using the form of insert where you don't specify column names?
IOW, your tuple has one more item than it is expecting ...

In any case, why have an auto_increment column but then increment it
yourself?

HTH,
John




More information about the Python-list mailing list