From: | Chris McDonald <chrisjonmcdonald(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Best way to import a plpythonu module |
Date: | 2008-11-18 11:51:43 |
Message-ID: | 826422c7-7aa6-497c-9b6f-5f11864a2bca@b31g2000prb.googlegroups.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I am using plpythonu on linux version postgresql-plpython-8.2.9-1.fc7.
Consider a python class called Wibble which is written into a python
module wibble.py.
I wish to use Wibble from within a plpythonu procedure.
If I simply do:
from wibble import Wibble
then I am told the object was not found, (presumably because postgres
does not know where the module is).
So as far as I can see, my available options to use class Wibble are:
1. Add code to modify the search path before my import statement. This
allows me to find wibble for the duration of my session I think
2. Set environment variable PYTHONPATH in user postgres .bash_profile
to add a directory where I can put my module - then restart
postgresql. This does not seem particularly safe to me though. I also
wonder if I would need to restart postgresql to reload a modified
module or whether the module is freshly read whenever a new reference
is made it it?
Is there a "best practise" approach here?
From | Date | Subject | |
---|---|---|---|
Next Message | Howard Cole | 2008-11-18 11:59:50 | Re: How to reduce impact of a query. |
Previous Message | Ivan Sergio Borgonovo | 2008-11-18 09:49:12 | Re: still gin index creation takes forever |