473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

plpython and pickle

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

Aug 17 '06 #1
1 1932
On 2006-08-17, Gerardo Herzig <gh*****@fmed.uba.arwrote:
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?
Aug 18 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael Hohn | last post by:
Hi, under python 2.2, the pickle/unpickle sequence incorrectly restores a larger data structure I have. Under Python 2.3, these structures now give an explicit exception from...
2
by: Mage | last post by:
Hello! create or replace function trigger_keywords_maintain() returns trigger as $$ return 'MODIFY' $$ language plpythonu; update table set id = id where id = 7; ERROR: invalid input...
6
by: Josué Maldonado | last post by:
Hello list, First of all excuse me if this question is so obvius, I have not found the info I need on this. I installed pg 7.4.1 from source, now I need to add plpython lang, should I have to...
3
by: Clodoaldo Pinto Neto | last post by:
Hi all, I'm restoring a database from 7.3.4 FC1 to 7.4.2 FC2: $ pg_restore -d KakaoStats KakaoStats.dump pg_restore: could not execute query: ERROR: could not access file...
2
by: Jerry LeVan | last post by:
Have any configure experts looked at building plpython.so on mac os x lately? The standard configure key "--with-python" fails miserably (libpython is not a shared lib error message). I found...
5
by: Sim Zacks | last post by:
I have the following function and I am getting an invalid syntax error when I try to run it. I have tried the function a number of ways including with named parameters and non-named parameters...
0
by: RL | last post by:
Hi, I am trying to implement a few functions in Plpython (in Postgresql 8.0.1). However, I could find the solution in the documentation, so I would appreciate your help. My question is how to...
0
by: Gerardo Herzig | last post by:
Hi all. Im having a hard time trying to compile the plpython package. This is the error make gives me: gherzig@vdb:/usr/local/src/postgresql-8.2.5/src/pl/plpythonmake gcc -O2 -Wall...
1
by: IceMan85 | last post by:
Hi to all, I have spent the whole morning trying, with no success to pickle an object that I have created. The error that I get is : Can't pickle 'SRE_Match' object: <_sre.SRE_Match object at...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.