cPickle and pgsql...damn!!

Gerardo Herzig -Departamento de Proyectos Especiales e Internet- Facultad de Medicina gherzig at fmed.uba.ar
Tue Jul 20 23:48:29 CEST 2004


Hi people, im having trouble when trying to UnPickle a 'pickled' field from a 
psql (7.3) field.

I just want:

>damnDict = {'foo' : 'bar'}
>serializedDict = cPickle.dumps(damnDict)
>print serializedDict
>'}q\x01U\x03fooq\x03barq\x03s.'
>pgconn.query('insert into TABLE values (%s)' % serializedDict)
>result = pgconn.query('select * from TABLE').getresult()[0]
>print result
>'}qx01Ux03fooqx03barqx03s.'
And....voila!! There is not the same piece of crap!!
When i try to unpickle it (and get the original damnDict) i got 'Cant find 
MARK' error msg. Maybe this is a PostgreSQL issue, but if someone have a 
clue....
Here is the data
Python 2.2
PostgreSQL 7.3
The field where i put the serialized data is a text field.

Thanks!
-- 
Gerardo Herzig
Departamento de Proyectos Especiales e Internet
Facultad de Medicina
U.B.A.



More information about the Python-list mailing list