I have postgreSQL version 8.3 installed on an ubuntu machine. This was installed via apt get. When I was trying to source a database dump that has some plsql functions written, I got the following error -
could not access file "$libdir/plpython": No such file or directory
When I tried to enable python support for a particular database, I got yet another error -
$ createlang plpythonu <dbname> -U postgres
createlang: language installation failed: ERROR: could not access file "$libdir/plpython": No such file or directory
Is there a way that I can add support for python without having to reinstall postgreSQL?
How to Connect to PostgreSQL from Python? In order to connect to a PostgreSQL database instance from your Python script, you need to use a database connector library. In Python, you have several options that you can choose from. Some libraries that are written in pure Python include pg8000 and py-postgresql.
If a language is installed into template1 , all subsequently created databases will have the language installed automatically. PL/Python is only available as an “untrusted” language, meaning it does not offer any way of restricting what users can do in it and is therefore named plpython3u .
Psycopg2 is a PostgreSQL database driver, it is used to perform operations on PostgreSQL using python, it is designed for multi-threaded applications. SQL queries are executed with psycopg2 with the help of the execute() method. It is used to Execute a database operation query or command.
sudo apt-get install postgresql-plpython-8.3
or for postgresql 8.4:
sudo apt-get install postgresql-plpython-8.4
Install postgresql-plpython-8.3
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With