[DB-SIG] adodbapi 2.4 : not possible to pickle

Vernon Cole vernondcole at gmail.com
Tue Oct 19 18:11:14 CEST 2010


Hmmm... pickle was one thing I failed to consider when I changed the
adodbapi .fetchxxx methods to return a sequence-like object (_SQLrow) rather
than an actual tuple. Since I have never had the need to use pickle, I have
never tested it. Frankly, it never occurred to me that one would ever want
to serialize data which just came in from a data base.

 As you have noticed, data in an _SQLrow object are not converted into
Python types until extracted from the object by its _getValue() method. In
previous versions, the conversion was done before you received the data.

  The quickest workaround would be (in your code) to simply call tuple() on
the returned row object before pickling it.  That should give the same
result as before, when tuple() was called internally.

  If this is something which is done frequently, then a perhaps a suitable
method should be added to the class definition of _SQLrow() so that pickle
would work on it directly.  Is __getstate__() what one uses for this?
--
Vernon

On Tue, Oct 19, 2010 at 7:57 AM, William Dode <wilk at flibuste.net> wrote:

> Hi,
>
> Since adodbapi 2.4 it's not more possible to pickle a recordset when
> there is a datetime column in the result. I've digged, it's because
> PyTime object are kept in _SQLRow
>
> Is there a workaround ?
>
> thanks
>
> --
> William Dodé - http://flibuste.net
> Informaticien Indépendant
>
> _______________________________________________
> DB-SIG maillist  -  DB-SIG at python.org
> http://mail.python.org/mailman/listinfo/db-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/db-sig/attachments/20101019/3b2eb1b7/attachment.html>


More information about the DB-SIG mailing list