On 09/30/2011 05:10 AM, Joe Abbate wrote:
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