Re: PL/Python

From: Sim Zacks <sim(at)compulab(dot)co(dot)il>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: PL/Python
Date: 2011-10-02 12:02:48
Message-ID: 4E8852E8.3000006@compulab.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="direction: ltr;">
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<style>body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body style="direction: ltr;"
bidimailui-detected-decoding-type="latin-charset" bgcolor="#ffffff"
text="#000000">
On 09/30/2011 05:10 AM, Joe Abbate wrote:
<blockquote cite="mid:4E852515(dot)5010801(at)freedomcircle(dot)com"
type="cite">
<pre wrap="">Although there are no discussions or examples in the documentation, I've
determined that PL/Python supports Python new style classes like class
Test(object), and import of standard modules.

Now, in order for to_yaml/to_map to do its work, it needs to import 15
modules, e.g.,

from pyrseas.dbobject.language import LanguageDict

I'd be interested to know if anyone has tried something similar (in
terms of scope) and if so, how they tackled it.

The other function, diff_yaml() or diff_map(), is a bit trickier because
it requires reading in a YAML spec file, like the one above, and then
comparing it to the internal version of to_yaml/to_map, in order to
output SQL DDL statements. The command line tool could read the spec
file locally and send it off as one big text argument. Again, I'm
interested in similar experiences if any.
</pre>
</blockquote>
If I understand plpython correctly, it uses the python installed on
the machine. In other words, plpythonu doesn't support the new style
classes, it depends on what version of python is installed.<br>
In the same way, if you have libraries installed on your machine,
plpythonu has access to them as well. So if someone installed
pyrseas, he would be able to use all the functions from within his
function. <br>
<br>
IMO, there is no need for an extension here, all you need to do is
have an sql file containing your 2 plpythonu functions that can be
run into the database.<br>
<br>
Sim <br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 2.0 KB

In response to

  • PL/Python at 2011-09-30 02:10:29 from Joe Abbate

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andy Colson 2011-10-02 12:35:53 Re: Why PGSQL has no developments in the .NET area?
Previous Message r d 2011-10-02 10:41:20 Updating 9.0.4 --> 9.1.1: How best to ???