Re: PL/Python - Mailing list pgsql-general

From Sim Zacks
Subject Re: PL/Python
Date
Msg-id 4E8852E8.3000006@compulab.co.il
Whole thread Raw
In response to PL/Python  (Joe Abbate <jma@freedomcircle.com>)
Responses Re: PL/Python  (Joe Abbate <jma@freedomcircle.com>)
List pgsql-general
<meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    body p { margin-bottom: 0cm; margin-top: 0pt; }

  <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.5010801@freedomcircle.com"
      type="cite">
      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.


    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.
    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.

    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.

    Sim

pgsql-general by date:

Previous
From: Andy Colson
Date:
Subject: Re: Why PGSQL has no developments in the .NET area?
Next
From: pasman pasmański
Date:
Subject: Re: How to find freak UTF-8 character?