List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:June 22 2002 1:22am
Subject:Re: Error on insert statement...
View as plain text  
At 17:30 -0400 6/21/02, Michael Jessop wrote:
>Can someone tell me what this means?  I mean, I guess I *know* what it
>means, but why?

Placeholders for Python scripts using MySQLdb should be %s, not ?.
Convert your ? characters to %s and see what happens.

>
>The insert statement into a mysql database is...
>
>'insert into works values(?, ?, ?, ?, ? ,?)'
>
>The invocation of the dynamic sql is...
>
>     status = cur_mysql.execute(sql,
>         (wrk_inst, ZERO, trs_inst, aas_inst, title, NADA))
>
>(ZERO = 0L and NADA = 'N/A')
>
>I do a print of the wrk_inst, trs_inst, aas_inst (and zero and nada)
>followed by a print of title before the error...
>
>80956 177802 0 0 N/A
>WANTED ... A BROTHER
>
>...here is the error...
>
>Exception in Tkinter callback
>Traceback (most recent call last):
>   File "C:\Python22\lib\lib-tk\Tkinter.py", line 1292, in __call__
>     return apply(self.func, args)
>   File "C:\Documents and Settings\mjessop\My Documents\Python
>Development\Catalo
>g\catalog_gui.py", line 82, in engage
>     catalog.extract_works()
>   File "C:\Documents and Settings\mjessop\My Documents\Python
>Development\Catalo
>g\catalog_model.py", line 249, in extract_works
>     (wrk_inst, ZERO, trs_inst, aas_inst, title, NADA))
>   File "C:\Python22\Lib\site-packages\MySQLdb\cursors.py", line 70, in
>execute
>     raise ProgrammingError, m.args[0]
>ProgrammingError: not all arguments converted
>
>======
>here is a description of the database table...
>
>mysql> describe works
>     -> ;
>+----------+--------------+------+-----+---------+-------+
>| Field    | Type         | Null | Key | Default | Extra |
>+----------+--------------+------+-----+---------+-------+
>| wrk_inst | int(11)      |      | MUL | 0       |       |
>| sinker   | int(11)      |      | MUL | 0       |       |
>| trs_inst | int(11)      | YES  |     | 0       |       |
>| aas_inst | int(11)      | YES  |     | 0       |       |
>| title    | varchar(255) | YES  |     | NULL    |       |
>| pub_name | varchar(80)  | YES  |     | NULL    |       |
>+----------+--------------+------+-----+---------+-------+
>6 rows in set (0.03 sec)
>
>Any thoughts?
>
>Thank you, in advance...
>
>+++-------------+++--------------+++
>+ Michael S. Jessop                +
>| Senior Web Developer             |
>+ Copyright Clearance Center, Inc. +
>+++-------------+++--------------+++

Thread
Error on insert statement...Michael Jessop21 Jun
  • Nasty LIMIT/multi-table DELETE bug?Jon Frisby21 Jun
  • Re: Error on insert statement...Paul DuBois22 Jun
Re: Nasty LIMIT/multi-table DELETE bug?Heikki Tuuri22 Jun
  • Re: Nasty LIMIT/multi-table DELETE bug?Sinisa Milivojevic22 Jun
Re: Nasty LIMIT/multi-table DELETE bug?Jocelyn Fournier22 Jun