MySQLdb error for sql >64K

wes weston wweston at att.net
Sat Apr 17 09:40:16 EDT 2004


JZ wrote:
> I cannot execute insert data into TEXT field if that data is bigger than
> 64KB. :(
> 
> 
>>>>cursor.execute("INSERT INTO table (field) VALUES(%s) WHERE id=1", myValue)
> 
> 
> Traceback (most recent call last):
> File "<interactive input>", line 1, in ?
> File "C:\opt\PYTHON~1\lib\site-packages\MySQLdb\cursors.py", line 95, in
> execute
>     return self._execute(query, args)
> File "C:\opt\PYTHON~1\lib\site-packages\MySQLdb\cursors.py", line 114, in
> _execute
>    self.errorhandler(self, exc, value)
> File "C:\opt\PYTHON~1\lib\site-packages\MySQLdb\connections.py", line 33,
> in defaulterrorhandler
>    raise errorclass, errorvalue
> Warning: Rows matched: 1  Changed: 0  Warnings: 1
> 
> The same sql query executed using MySQLFront client works without any
> problems. So, I think the problem must be with MySQLdb 0.9.2 module.
> 
> Any suggestions?
> 
> --
> JZ

jz,
    A MYSQL "text" type can be 0 to 65535 bytes; a "mediumtext"
type 2**8 times as big. Just a guess but maybe the failing
insert checks the sizes and the 'working' one just chops off
the excess. You could alter the column and try it fairly
easily.
wes




More information about the Python-list mailing list