plpython and pickle

Gerardo Herzig gherzig at fmed.uba.ar
Thu Aug 17 18:22:25 EDT 2006


Hi all, sory if this is kind of [OT], but cannot find the answer for
this behaviour

Im programming a db function using plpython...i have a db called
'sessions', and a postgres 8.1.2 database called 'test'. In 'sessions',
i store several values in a `pickled' way so
If a do
"""
	You are now connected to database "sessions".
	sessions=# select * from getsessiondata('QQtEpLoKHnvbKGSpgJgYMPyCdHgXSi');
                                                                                                                                                                             getsessiondata                                                                                                                                                                             
	------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	 (dp0--ENTER--S---alucod-----ENTER--p1--ENTER--S---32009436-----ENTER--p2--ENTER--sS---respuestas_1-----ENTER--p3--ENTER--S---3-----ENTER--p4--ENTER--sS---respuestas_2-----ENTER--p5--ENTER--S---2-----ENTER--p6--ENTER--sS---respuestas_3-----ENTER--p7--ENTER--S---4-----ENTER--p8--ENTER--sS---submit-----ENTER--p9--ENTER--S---Responder-----ENTER--p10--ENTER--s.
	(1 row)
"""
Perfect. Thats what i spect to see.


Now, if i do (in 'test' database)
"""
data = plpy.execute("SELECT * from dblink('dbname=sessions', 'select * from getsessiondata(\'\'%s\'\')') as t1(session_data name); " % session_id)[0]["session_data"];
plpy.notice(data)
"""
i got this
NOTICE:  ("'(dp0--ENTER--S---alucod-----ENTER--p1--ENTER--S---32009436-----'",)

The pickled string as been truncated at some point, and when i try to unpickle it, i got error.

Now, the question: 
	What da hell can i do?

-Postgresql 8.1.2
-Python 2.4.2

Im not even sure if this is a pickle, plpython nor postgresql issue, so
im sory if this is [OT] here.

Thanks!!
Gerardo




More information about the Python-list mailing list