I am having the same problem with mysql version 5.0.22.
MySQLdb is 1.2.1c3
I get the following warnings:
Warning: Records: 2 Duplicates: 0 Warnings: 1
If I modify executemany in cursor.py
from:
if not m:
r = 0
for a in args:
r = r + self.execute(query, a)
return r
to:
r = 0
for a in args:
r = r + self.execute(query, a)
return r
The warning do not happen. Is there any way to get what the warning is. I have check and this is all that is being return to python.
The more records that go into the insert the more warning I get.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Without your query and data and schema, it's pretty hard to guess. With MySQLdb-1.2.1 and MySQL-4.1 or newer, you should get individual warnings for each record. You are using a release candidate, and that one may not have the support for MySQL SHOW WARNINGS. Get 1.2.1_p2 and try again.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm getting warnings and I don't want to see them. :-)
MySQLdb 1.2.0 final, python 2.4.2, mysql 4.1.14
Code is basically this:
Each time the last line exeucutes, I get something like this:
Warning: Records: 315 Duplicates: 315 Warnings: 315
cursor.execute(query, args)
How can I explicity turn off the warnings? Thanks!
I am having the same problem with mysql version 5.0.22.
MySQLdb is 1.2.1c3
I get the following warnings:
Warning: Records: 2 Duplicates: 0 Warnings: 1
If I modify executemany in cursor.py
from:
if not m:
r = 0
for a in args:
r = r + self.execute(query, a)
return r
to:
r = 0
for a in args:
r = r + self.execute(query, a)
return r
The warning do not happen. Is there any way to get what the warning is. I have check and this is all that is being return to python.
The more records that go into the insert the more warning I get.
Without your query and data and schema, it's pretty hard to guess. With MySQLdb-1.2.1 and MySQL-4.1 or newer, you should get individual warnings for each record. You are using a release candidate, and that one may not have the support for MySQL SHOW WARNINGS. Get 1.2.1_p2 and try again.
Read the python documentation for the warnings module.
http://docs.python.org/lib/module-warnings.html
Specifically read up on filterwarnings. You can also make all warnings raise exceptions (like what pre-1.2.0 did) by doing:
warnings.filterwarnings("error", module="MySQLdb")
(This is the opposite of what you asked; read the docs!)
1.2.1 will include much more information about warnings. The above query would actually print 315 warnings. Who knows, they might be important...
But is there any way to see these warnings? I mean, warnings text instead of this: "Warning: Records: 315 Duplicates: 315 Warnings: 315" ?
With MySQL-4.1 and MySQLdb-1.2.1, yes, all the warnings are issued individually and have useful warning text.