Thread: plpython3u extension
Hi,
I have installed PostgreSQL Server 9.6.0 and Python 3.4.2 on Windows 2012 R2 Server. In order to use Psycopg, I need this extension enabled in Postgres: plpython3u
I copied plpython3.dll to C:/Program Files/PostgreSQL/9.6/lib/ , from the python 3 install folder.
The in PostgreSQL I try running this command: CREATE EXTENSION plpython3u;
And I receive this message:
ERROR: could not load library "C:/Program Files/PostgreSQL/9.6/lib/plpython3.dll": The specified module could not be found.
Under this folder: C:\Program Files\PostgreSQL\9.6\share\extension there are plpython3u files.
How can I get PostgreSQL to recognize this Python 3 extension? Or is there an installer somewhere that will automatically enable this extension in the Postgres server?
Thanks!
On 10/02/2016 09:32 AM, Antonio Gomez wrote: > > > Hi, > > > > I have installed PostgreSQL Server 9.6.0 and Python 3.4.2 on Windows > 2012 R2 Server. In order to use Psycopg, I need this extension enabled > in Postgres: plpython3u How did you install Postgres 9.6? Psycopg is not used by plpython3u or vica versa, so you may need to explain why you need to install the extension? > > > > I copied plpython3.dll to C:/Program Files/PostgreSQL/9.6/lib/ , from > the python 3 install folder. > > > > The in PostgreSQL I try running this command: CREATE EXTENSION plpython3u; > > > > And I receive this message: > > > > ERROR: could not load library "C:/Program > Files/PostgreSQL/9.6/lib/plpython3.dll": The specified module could not > be found. > > > > Under this folder: C:\Program Files\PostgreSQL\9.6\share\extension there > are plpython3u files. > > > > How can I get PostgreSQL to recognize this Python 3 extension? Or is > there an installer somewhere that will automatically enable this > extension in the Postgres server? That would depend on the answer to the first question above? > > > > Thanks! > -- Adrian Klaver adrian.klaver@aklaver.com
Thanks for your reply Adrian. We installed Postgres 9.6 by downloading the msi package from the Postgres site and running the installer in the normal fashion. We basically need to make python available in postgresql to create python functions . And make psycopg2 available in python to connect python to other postgresql instances. We want to use psycopg2 in python to connect to other postgresql instances because psycopg2 is the most used library in pythonto talk to postgres. Thanks. --A. -----Original Message----- From: Adrian Klaver [mailto:adrian.klaver@aklaver.com] Sent: Sunday, October 02, 2016 3:09 PM To: Antonio Gomez <AGomez@EBSCO.COM>; psycopg@postgresql.org Subject: Re: [psycopg] plpython3u extension On 10/02/2016 09:32 AM, Antonio Gomez wrote: > > > Hi, > > > > I have installed PostgreSQL Server 9.6.0 and Python 3.4.2 on Windows > 2012 R2 Server. In order to use Psycopg, I need this extension enabled > in Postgres: plpython3u How did you install Postgres 9.6? Psycopg is not used by plpython3u or vica versa, so you may need to explain why you need to install the extension? > > > > I copied plpython3.dll to C:/Program Files/PostgreSQL/9.6/lib/ , from > the python 3 install folder. > > > > The in PostgreSQL I try running this command: CREATE EXTENSION > plpython3u; > > > > And I receive this message: > > > > ERROR: could not load library "C:/Program > Files/PostgreSQL/9.6/lib/plpython3.dll": The specified module could > not be found. > > > > Under this folder: C:\Program Files\PostgreSQL\9.6\share\extension > there are plpython3u files. > > > > How can I get PostgreSQL to recognize this Python 3 extension? Or is > there an installer somewhere that will automatically enable this > extension in the Postgres server? That would depend on the answer to the first question above? > > > > Thanks! > -- Adrian Klaver adrian.klaver@aklaver.com
On 03/10/16 00:44, Antonio Gomez wrote: > We installed Postgres 9.6 by downloading the msi package from the Postgres site and running the installer in the normalfashion. > > We basically need to make python available in postgresql to create python functions . > And make psycopg2 available in python to connect python to other postgresql instances. I'd use PostgreSQL native FDW for that, not psycopg running inside PostgreSQL. federico -- Federico Di Gregorio federico.digregorio@dndg.it DNDG srl http://dndg.it La mia nuova versione del mondo prevede una consapevolezza distribuita e insapore. -- sisterconfusion
On 10/02/2016 03:44 PM, Antonio Gomez wrote: > Thanks for your reply Adrian. > > We installed Postgres 9.6 by downloading the msi package from the Postgres site and running the installer in the normalfashion. Are you talking about this?: http://www.enterprisedb.com/products-services-training/pgdownload#windows If not can you point to the specific location where you got the code? If so then you should take a look at: http://get.enterprisedb.com/docs/README-edb-languagepack-9.6.txt > > We basically need to make python available in postgresql to create python functions . > And make psycopg2 available in python to connect python to other postgresql instances. To add to Federico's answer: https://www.postgresql.org/docs/9.6/static/postgres-fdw.html > > We want to use psycopg2 in python to connect to other postgresql instances because psycopg2 is the most used library inpython to talk to postgres. > > Thanks. > --A. > > -----Original Message----- > From: Adrian Klaver [mailto:adrian.klaver@aklaver.com] > Sent: Sunday, October 02, 2016 3:09 PM > To: Antonio Gomez <AGomez@EBSCO.COM>; psycopg@postgresql.org > Subject: Re: [psycopg] plpython3u extension > > On 10/02/2016 09:32 AM, Antonio Gomez wrote: >> >> >> Hi, >> >> >> >> I have installed PostgreSQL Server 9.6.0 and Python 3.4.2 on Windows >> 2012 R2 Server. In order to use Psycopg, I need this extension enabled >> in Postgres: plpython3u > > How did you install Postgres 9.6? > > Psycopg is not used by plpython3u or vica versa, so you may need to explain why you need to install the extension? > >> >> >> >> I copied plpython3.dll to C:/Program Files/PostgreSQL/9.6/lib/ , from >> the python 3 install folder. >> >> >> >> The in PostgreSQL I try running this command: CREATE EXTENSION >> plpython3u; >> >> >> >> And I receive this message: >> >> >> >> ERROR: could not load library "C:/Program >> Files/PostgreSQL/9.6/lib/plpython3.dll": The specified module could >> not be found. >> >> >> >> Under this folder: C:\Program Files\PostgreSQL\9.6\share\extension >> there are plpython3u files. >> >> >> >> How can I get PostgreSQL to recognize this Python 3 extension? Or is >> there an installer somewhere that will automatically enable this >> extension in the Postgres server? > > That would depend on the answer to the first question above? > >> >> >> >> Thanks! >> > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com
Hi Adrian, Thanks for your replies again! Please forgive my lack of knowledge on this, we are very new to Postgres. This is where I got it: http://get.enterprisedb.com/postgresql/postgresql-9.6.0-1-windows-x64.exe After reading your and Federico's reply's we are willing to forgo using Psycops2. Here's our concern using FDW, we've read that FDW can bring data in from the foreign server into the local server. As we're going to use this with AWS Redshift where we keep our data warehouses, we do not want to bring data back we justwant let the server process everything with the queries we send through FDW and have it dump the results out to a file,though the redshift Unload command. The reason for this proxy server configuration is that we'd like to use our own custom/dynamic query logic wrapped in functions,which Redshift does not provide. To that end here is my question: Do we necessarily need to map local tables to foreign tables using FDW, or can we just send queries to the foreign serverdirectly? Thank you! -----Original Message----- From: Adrian Klaver [mailto:adrian.klaver@aklaver.com] Sent: Sunday, October 02, 2016 7:59 PM To: Antonio Gomez <AGomez@EBSCO.COM>; psycopg@postgresql.org Subject: Re: [psycopg] plpython3u extension On 10/02/2016 03:44 PM, Antonio Gomez wrote: > Thanks for your reply Adrian. > > We installed Postgres 9.6 by downloading the msi package from the Postgres site and running the installer in the normalfashion. Are you talking about this?: http://www.enterprisedb.com/products-services-training/pgdownload#windows If not can you point to the specific location where you got the code? If so then you should take a look at: http://get.enterprisedb.com/docs/README-edb-languagepack-9.6.txt > > We basically need to make python available in postgresql to create python functions . > And make psycopg2 available in python to connect python to other postgresql instances. To add to Federico's answer: https://www.postgresql.org/docs/9.6/static/postgres-fdw.html > > We want to use psycopg2 in python to connect to other postgresql instances because psycopg2 is the most used library inpython to talk to postgres. > > Thanks. > --A. > > -----Original Message----- > From: Adrian Klaver [mailto:adrian.klaver@aklaver.com] > Sent: Sunday, October 02, 2016 3:09 PM > To: Antonio Gomez <AGomez@EBSCO.COM>; psycopg@postgresql.org > Subject: Re: [psycopg] plpython3u extension > > On 10/02/2016 09:32 AM, Antonio Gomez wrote: >> >> >> Hi, >> >> >> >> I have installed PostgreSQL Server 9.6.0 and Python 3.4.2 on Windows >> 2012 R2 Server. In order to use Psycopg, I need this extension >> enabled in Postgres: plpython3u > > How did you install Postgres 9.6? > > Psycopg is not used by plpython3u or vica versa, so you may need to explain why you need to install the extension? > >> >> >> >> I copied plpython3.dll to C:/Program Files/PostgreSQL/9.6/lib/ , from >> the python 3 install folder. >> >> >> >> The in PostgreSQL I try running this command: CREATE EXTENSION >> plpython3u; >> >> >> >> And I receive this message: >> >> >> >> ERROR: could not load library "C:/Program >> Files/PostgreSQL/9.6/lib/plpython3.dll": The specified module could >> not be found. >> >> >> >> Under this folder: C:\Program Files\PostgreSQL\9.6\share\extension >> there are plpython3u files. >> >> >> >> How can I get PostgreSQL to recognize this Python 3 extension? Or is >> there an installer somewhere that will automatically enable this >> extension in the Postgres server? > > That would depend on the answer to the first question above? > >> >> >> >> Thanks! >> > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com
On 10/03/2016 10:30 AM, Antonio Gomez wrote: > Hi Adrian, > > Thanks for your replies again! Please forgive my lack of knowledge on this, we are very new to Postgres. > > This is where I got it: > http://get.enterprisedb.com/postgresql/postgresql-9.6.0-1-windows-x64.exe Then look at: http://get.enterprisedb.com/docs/README-edb-languagepack-9.6.txt http://forums.enterprisedb.com/posts/list/4312.page The above refers to 9.4, but I believe that instructions still apply to 9.6. > > After reading your and Federico's reply's we are willing to forgo using Psycops2. > > Here's our concern using FDW, we've read that FDW can bring data in from the foreign server into the local server. AFAIK as I know the foreign table is just a mapping to the remote table. It will pull over data in a query, but the data is resident in the remote server. > > As we're going to use this with AWS Redshift where we keep our data warehouses, we do not want to bring data back we justwant let the server process everything with the queries we send through FDW and have it dump the results out to a file,though the redshift Unload command. > > The reason for this proxy server configuration is that we'd like to use our own custom/dynamic query logic wrapped in functions,which Redshift does not provide. > > To that end here is my question: > Do we necessarily need to map local tables to foreign tables using FDW, or can we just send queries to the foreign serverdirectly? dblink: https://www.postgresql.org/docs/9.6/static/dblink.html in particular: https://www.postgresql.org/docs/9.6/static/contrib-dblink-function.html > > Thank you! > > -----Original Message----- > From: Adrian Klaver [mailto:adrian.klaver@aklaver.com] > Sent: Sunday, October 02, 2016 7:59 PM > To: Antonio Gomez <AGomez@EBSCO.COM>; psycopg@postgresql.org > Subject: Re: [psycopg] plpython3u extension > > On 10/02/2016 03:44 PM, Antonio Gomez wrote: >> Thanks for your reply Adrian. >> >> We installed Postgres 9.6 by downloading the msi package from the Postgres site and running the installer in the normalfashion. > > Are you talking about this?: > > http://www.enterprisedb.com/products-services-training/pgdownload#windows > > If not can you point to the specific location where you got the code? > > If so then you should take a look at: > > http://get.enterprisedb.com/docs/README-edb-languagepack-9.6.txt > >> >> We basically need to make python available in postgresql to create python functions . >> And make psycopg2 available in python to connect python to other postgresql instances. > > To add to Federico's answer: > > https://www.postgresql.org/docs/9.6/static/postgres-fdw.html > >> >> We want to use psycopg2 in python to connect to other postgresql instances because psycopg2 is the most used library inpython to talk to postgres. >> >> Thanks. >> --A. >> >> -----Original Message----- >> From: Adrian Klaver [mailto:adrian.klaver@aklaver.com] >> Sent: Sunday, October 02, 2016 3:09 PM >> To: Antonio Gomez <AGomez@EBSCO.COM>; psycopg@postgresql.org >> Subject: Re: [psycopg] plpython3u extension >> >> On 10/02/2016 09:32 AM, Antonio Gomez wrote: >>> >>> >>> Hi, >>> >>> >>> >>> I have installed PostgreSQL Server 9.6.0 and Python 3.4.2 on Windows >>> 2012 R2 Server. In order to use Psycopg, I need this extension >>> enabled in Postgres: plpython3u >> >> How did you install Postgres 9.6? >> >> Psycopg is not used by plpython3u or vica versa, so you may need to explain why you need to install the extension? >> >>> >>> >>> >>> I copied plpython3.dll to C:/Program Files/PostgreSQL/9.6/lib/ , from >>> the python 3 install folder. >>> >>> >>> >>> The in PostgreSQL I try running this command: CREATE EXTENSION >>> plpython3u; >>> >>> >>> >>> And I receive this message: >>> >>> >>> >>> ERROR: could not load library "C:/Program >>> Files/PostgreSQL/9.6/lib/plpython3.dll": The specified module could >>> not be found. >>> >>> >>> >>> Under this folder: C:\Program Files\PostgreSQL\9.6\share\extension >>> there are plpython3u files. >>> >>> >>> >>> How can I get PostgreSQL to recognize this Python 3 extension? Or is >>> there an installer somewhere that will automatically enable this >>> extension in the Postgres server? >> >> That would depend on the answer to the first question above? >> >>> >>> >>> >>> Thanks! >>> >> >> >> -- >> Adrian Klaver >> adrian.klaver@aklaver.com >> > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com