Search Postgresql Archives

Re: PL/Python

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sim,

On 10/02/2011 08:02 AM, Sim Zacks wrote:
> 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.

Well, Python has had new style classes since 2.2 (December 2001).  PG
8.2 release notes says it supports Python 2.5 and the 9.0 notes show
support was added for Python 3.  Unless someone is running Python 2.1 or
earlier, it seems new style classes are available.

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

Yes, that seems to be the case, assuming the path to the library is
visible in (or added to) PYTHONPATH.

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

Maybe I'm misunderstanding something, but isn't such a sql file an
extension or is 95% of the way there?  Pyrseas is already distributed
via PGXN, but like some other PGXN "extensions" (dbi-link?), it doesn't
actually create functions in the database.  Its two utilities run
entirely as external programs.  If the Pyrseas functions were added via
an .sql file to a database, EXTENSION or not, they would be available
for use by non-Pyrseas programs, e.g., pgAdmin could call diff_map() to
compare database objects, Perl scripts or even a plain psql script could
call to_yaml().  And these would not depend on psycopg2, which currently
*is* a Pyrseas dependency (it would still be necessary for access to the
command line utilities).

Joe

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux