Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 32A1A682EAD for ; Sat, 3 Dec 2011 14:51:44 -0400 (AST) Received: from qmta12.westchester.pa.mail.comcast.net ([76.96.59.227]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RWugZ-0007rh-4s for pgsql-admin@postgresql.org; Sat, 03 Dec 2011 18:51:44 +0000 Received: from omta08.westchester.pa.mail.comcast.net ([76.96.62.12]) by qmta12.westchester.pa.mail.comcast.net with comcast id 4ips1i0030Fqzac5CirXRj; Sat, 03 Dec 2011 18:51:31 +0000 Received: from sz0093.wc.mail.comcast.net ([76.96.58.151]) by omta08.westchester.pa.mail.comcast.net with comcast id 4irX1i00T3FmDic3UirXag; Sat, 03 Dec 2011 18:51:31 +0000 Date: Sat, 3 Dec 2011 18:51:31 +0000 (UTC) From: Lou Picciano To: pgsql-admin@postgresql.org, pgsql-general@postgresql.org Cc: shreeseva.learning@gmail.com Message-ID: <824528607.643461.1322938291345.JavaMail.root@sz0093a.westchester.pa.mail.comcast.net> In-Reply-To: Subject: Re: returning results from plsql function to plpythonu function MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_643460_551535390.1322938291309" X-Originating-IP: [76.117.178.80] X-Mailer: Zimbra 6.0.13_GA_2934 (ZimbraWebClient - FF3.0 (Mac)/6.0.13_GA_2934) X-Pg-Spam-Score: -3.1 (---) X-Archive-Number: 201112/23 X-Sequence-Number: 38781 ------=_Part_643460_551535390.1322938291309 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit # Assuming your query here returns col1, col2, etc.: results = plpy.execute("select * from software.func1();") # these lines will return the results ---------- # - (where the first member of the array is the 'row number' of the result:) value1 = results[0][ "col1" ] value2 = results[0][ "col2" ] # --- Wanna see? plpy.notice("-- value1: ",value1) plpy.notice("-- value2: ",value2) can you please give me the example I am not a python programmer. Nor am I! Looks like your example, btw, is attempting string operations on something not yet quite a string! Pythons are dangerous. Be careful! Lou Picciano ----- Original Message ----- From: "c k" To: "Lou Picciano" Cc: "pgsql-admin" , pgsql-general@postgresql.org Sent: Saturday, December 3, 2011 1:01:39 PM Subject: Re: [ADMIN] returning results from plsql function to plpythonu function can you please give me the example I am not a python programmer. C P Kulkarni On Sat, Dec 3, 2011 at 11:25 PM, Lou Picciano < loupicciano@comcast.net > wrote: CP - You're missing a line in the middle; one which will extract specific content(s) from $results. Because, yes, without such a line, python will only return the object reference. Lou Picciano From: "c k" < shreeseva.learning@gmail.com > To: "pgsql-admin" < pgsql-admin@postgresql.org >, pgsql-general@postgresql.org Sent: Saturday, December 3, 2011 12:50:16 PM Subject: [ADMIN] returning results from plsql function to plpythonu function Hello friends, I am checking some logic which includes two functions. One is plsql function which returns text. Second function is plpythonu and contains one statement which outputs notice e.g. results = plpy.execute("select * from software.func1();") plpy.notice("%s" % col for col in results[0]) The same result is returned as a final return as notice. But it does not outputs the correct result which is returned from func1 (text in this case). Rather it outputs notice as NOTICE: at 0xb578cb6c> It doesn't prints the correct notice even by using plpy.notice("%s" %results) What can be the problem here? Thanks for help. C P Kulkarni ------=_Part_643460_551535390.1322938291309 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <= div style=3D'font-family: Verdana; font-size: 12pt; color: #000000'># Assum= ing your query here returns col1, col2, etc.:
results =3D plpy.execute("= select * from software.func1();")

# these lines will return the resu= lts ----------
# - (where the first member of the array is the 'row numb= er' of the result:)

 value1 =3D results[0][ "col1" ]
 v= alue2 =3D results[0][ "col2" ]

 # --- Wanna see?

plpy.no= tice("--   value1: ",value1)
plpy.notice("--   value= 2: ",value2)

can you please give me the example=
I am not a python programmer.

Nor am I!
Looks like your= example, btw, is attempting string operations on something not yet quite a= string!

Pythons are dangerous. Be careful!

Lou Picciano
<= br>
From: "c k" <shreeseva.learning@gmail.com>=
To: "Lou Picciano" <loupicciano@comcast.net>
Cc: "pgsql-admin" <pgsql-admin@postgresql.org>, pgsql-general@postgresql= .org
Sent: Saturday, December 3, 2011 1:01:39 PM
Subject: <= /b>Re: [ADMIN] returning results from plsql function to plpythonu function<= br>
can you please give me the example
I am not a python programmer.<= br>
C P Kulkarni



------=_Part_643460_551535390.1322938291309--