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

William Dode wilk at flibuste.net
Thu Oct 21 13:34:37 CEST 2010

On 19-10-2010, Vernon Cole wrote:
> --===============0015925617==
> Content-Type: multipart/alternative; boundary=001485f64746fd50ce0492fa8b98
> --001485f64746fd50ce0492fa8b98
> Content-Type: text/plain; charset=ISO-8859-1
> Content-Transfer-Encoding: quoted-printable
> Hmmm... pickle was one thing I failed to consider when I changed the
> adodbapi .fetchxxx methods to return a sequence-like object (_SQLrow) rathe=
> r
> 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?

Thanks, i will try. I use pickle for remote task, it's very usefull.

I use my own class to access the rows, like your SQLRows, maybe it could 
be fine to can choose to use it or not ?

William Dodé - http://flibuste.net
Informaticien Indépendant

More information about the DB-SIG mailing list