storing pickles in sql data base

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Jul 11 04:47:36 CEST 2007


En Tue, 10 Jul 2007 20:32:01 -0300, David Bear <david.bear at asu.edu>  
escribió:

> I need to store pickled objects in postgresql. I reading through the  
> pickle
> docs it says to always open a file in binary mode because you can't be  
> sure
> if the pickled data is binary or text. So I have 2 question. Can I set  
> the
> pickle to be text -- and then store it in a 'text' type field in my sql
> table, or should what sql type should I save the pickle as?

I'd use a binary datatype (raw, blob, binary, whatever postgres calls it).  
Text columns might be converted or reencoded in some way, binary data  
should never be modified in any way.

-- 
Gabriel Genellina




More information about the Python-list mailing list