myqsldb warning problem

Steve Holden sholden at holdenweb.com
Sat Aug 10 15:41:10 EDT 2002


"Bill Dandreta" <wjdandreta at worldnet.att.net> wrote in message
news:3d540f5c.18282079 at netnews.worldnet.att.net...
> Hi Joshua,
>
> >You need to derive from a db connection that does not raise() on
> >errors.   Examine the Mysql module, I have used this quite a lot, and
>
> Thanks for the tip. I tried it and it worked for the smaller update
> strings but when I tried with the larger ones I get the following
> error:
>
> Error:2006: Mysql server has gone away
>
> I seemed to have resolved that error by updating 1000 records at a
> time.
>
> >there are any number of reasons why mysql is 'warning'.  It could be a
> >changed field type, or slightly adjusted data, or a index that didn't
> >fit.   For most circumstances this is safe to ignore, just read the
> >mysqlmodule.py [whatever it's called now], and there is an easy way to
> >use the no-warning class. [CursorNW I think, can't remember]
>
> I am quite sure there are no errors in the data because updating one
> record at a time gives no warnings or errors but using the same data,
> as soon as I start updating the records in groups, warnings start to
> show up. (I tried updating 10 records at a time and it still gives
> warnings occassionally. ) When I put a huge string (one was over 5 MB)
> in cursor.execute(mystring), I get the above message. The 1000 record
> update has around 200KB string and it does not give the error (so far)
>
> I suspect either MySQLdb or mysql itself has a problem with block
> updates.
>

Indeed it does. I noticed this when adding newsgroup articles to a database:
one article with an attachment of 5MB caused precisely this failure. You can
(if it really is the same problem I saw) by increasing your server's
"max_alowed_packet" variable. Mine was initially set at 1MB, and making it
16MB removed the error.

regards
-----------------------------------------------------------------------
Steve Holden                                 http://www.holdenweb.com/
Python Web Programming                http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------








More information about the Python-list mailing list