unpickling stackunderflow: MySQLdb 1.2.1g3 is returning array instances for BLOB columns
I think the fix is to specialize the PickleType in sqlalchemy.database.mysql based on the version of the driver. I'll try to rustle up a patch if this ticket isn't declared bogus.
* mysqld 4.1.12-Debian_1ubuntu3.1
* sqlalchemy trunk r1306
* MySQLdb 1.2.1g3
* python 2.4.2 gcc 4.0.2
stacktrace::
UnpicklingError: unpickling stack underflow
Traceback:
File "tables.py", line 266, in ?
encoding='latin1')
File "tables.py", line 259, in test_tables
print row
File "/home/robin/devel/sqlalchemy/lib/sqlalchemy/engine.py", line 863, in __repr__
return repr(tuple([key) for key in range(0, len(self.__row))](self.__parent._get_col(self.__row,)))
File "/home/robin/devel/sqlalchemy/lib/sqlalchemy/engine.py", line 812, in _get_col
return rec[0](0).engine_impl(self.engine).convert_result_value(row[rec[1](rec[1)], self.engine)
File "/home/robin/devel/sqlalchemy/lib/sqlalchemy/types.py", line 175, in convert_result_value
return pickle.loads(str(buf))
Traceback (most recent call last):
File "tables.py", line 266, in ?
encoding='latin1')
File "tables.py", line 259, in test_tables
print row
File "/home/robin/devel/sqlalchemy/lib/sqlalchemy/engine.py", line 863, in __repr__
return repr(tuple([key) for key in range(0, len(self.__row))](self.__parent._get_col(self.__row,)))
File "/home/robin/devel/sqlalchemy/lib/sqlalchemy/engine.py", line 812, in _get_col
return rec[0](0).engine_impl(self.engine).convert_result_value(row[rec[1](rec[1)], self.engine)
File "/home/robin/devel/sqlalchemy/lib/sqlalchemy/types.py", line 175, in convert_result_value
return pickle.loads(str(buf))
cPickle.UnpicklingError: unpickling stack underflow
Comments (5)
-
Account Deleted -
repo owner wouldnt we want to fix the MySQL binary type to return the same kind of data as everything else ?
-
Account Deleted Thats what I tried initialy. Modified
MSBinary
and introducedMSPickleType
, declared the appropriate mapping fromPickleType
toMSPickleType
, but got bogged down in inhertance / aggregation issues etc. Couldn't get it to work.I was thinking that for classes like
PickleType
, and for simple differences in the type of python intrinsic used, it covers more ground to make the less elegant change in one obviouse place. But yes, I aggree, my first instinct was to changeMSBinnary
as you suggest. -
repo owner just dont worry about this one. the types system is totally busted, apparently im going to have to rework it all over again.
-
repo owner - changed status to resolved
Ok this is fixed for now, unfortunately I had to modify the types system again and break the documented method of creating custom types...(TypeDecorator is back....), in changeset:1356
also you can run the full suite of unittests with mysql now as I qualified the non-passing tests with a decorator.
- Log in to comment
adds is instance(value, array) check to types.Binary, benign for drivers that do not return blobs as python.array instances