MySQLdb warnings ... what caused them?

Dave Reed dreed at capital.edu
Tue May 13 07:20:37 EDT 2003


On Tuesday 13 May 2003 02:12, Sheila King wrote:
> I'm just getting my feet wet in MySQL and in using the Python MySQLdb
> module to work with MySQL databases.
> 
> I had written the following code snippet:
> 
> c.executemany("""INSERT INTO test (ID, name, phone) VALUES (%s, %s, 
%s)""",
>     [ (1, "mary", "111-222-3333"),
>       (2, "john", "444-555-6666"),
>       (3, "steve", "777-888-9999")] )
> 
> Which gave me the following error/warning message(s):
> 
> 
> Traceback (most recent call last):
>   File "sqltest.py", line 13, in ?
>     [ (1, "mary", "111-222-3333"),
>   File 
"/big/dom/xexample/lib/python2.2/site-packages/MySQLdb/cursors.py",
> line 162, in executemany
>     r = self._query(join(q,',\n'))
>   File 
"/big/dom/xexample/lib/python2.2/site-packages/MySQLdb/cursors.py",
> line 249, in _query
>     rowcount = self._BaseCursor__do_query(q)
>   File 
"/big/dom/xexample/lib/python2.2/site-packages/MySQLdb/cursors.py",
> line 176, in __do_query
>     self._check_for_warnings()
>   File 
"/big/dom/xexample/lib/python2.2/site-packages/MySQLdb/cursors.py",
> line 231, in _check_for_warnings
>     raise Warning, info
> _mysql_exceptions.Warning: cords: 3  Duplicates: 0  Warnings: 3

<snip>

What are the types for your table columns?

Shouldn't your format string be: (%d, %s, %s)?

Dave







More information about the Python-list mailing list