plpython and pickle

G

Gerardo Herzig

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
 
L

Lee Harr

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

Might try on a postgres mailing list. I'd say it is more
on topic there...

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.

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-----'",)


Can you try just...
SELECT * from dblink('dbname=sessions', 'select * from
getsessiondata('QQtEpLoKHnvbKGSpgJgYMPyCdHgXSi');

Im not even sure if this is a pickle, plpython nor postgresql issue

or a dblink issue?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top