Plpythonu : Procedural Language inside Postgresql
1]The PL/Python procedural language allows PostgreSQL functions to be written in the Python Language.
2] use below command to install plpython with postgresql
sudo yum install postgresql96-plpython (mostly this is already done on all servers)
we mentioned postgresql96 because we are used postgresql 9.6 version on every server.
3] To install PL/Python in a particular database, we have to create the plpythonu extension on that particular database.
3] The command is : create language plpythonu (mostly this is already done on all servers)
please check python version before creating an extension database.
if the server have python 2 verion then use: create language plpythonu and plpython2u
if the server have python3 version then use : create langauge plpython3u;
4] If we are successful to create extension of plpython on each database then we are execute the command without any error.
Use this link to create a function : https://www.postgresql.org/docs/9.4/plpython-funcs.html