pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ilya Anfimov <ilan@tzirechnoy.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: How to control which Python interpreter Postgres uses?
Date: Tue, 2 Nov 2021 09:31:58 +0300
Message-ID: <20211102063158.GB1678439@azor.tzirechnoy.ru> (raw)
In-Reply-To: <CAOC+FBWQTA5hfTEg16+kVGkQ2oO-CDr4Ma9Ny8wQe=ZuEieEQA@mail.gmail.com>
References: <CY4PR19MB1160F38876C947812CA2CD63B58A9@CY4PR19MB1160.namprd19.prod.outlook.com>
	<1311504.1635804203@sss.pgh.pa.us>
	<CY4PR19MB11601C0A90A33E6FC24D8C70B58A9@CY4PR19MB1160.namprd19.prod.outlook.com>
	<CAOC+FBWQTA5hfTEg16+kVGkQ2oO-CDr4Ma9Ny8wQe=ZuEieEQA@mail.gmail.com>

On Mon, Nov 01, 2021 at 04:08:01PM -0700, Wells Oliver wrote:
>    Apologies if I'm misunderstanding, but you can specify a virtual env (so
>    any interpreter) as we did here:

 This  probably  wouldn't  allow access to the plpy server access
module. Only simplest stored procedures would  work  without  the
ability  to work with the database (and python version is usually
less of importance for such simple scripts).



>    CREATE FUNCTION slack (msg text)
>        RETURNS boolean
>    AS $$
>        hook = 'https://...';
>        activate_this = '/opt/python/env/bin/activate_this.py'
>        exec(open(activate_this).read(), dict(__file__=activate_this))
>        from slack_sdk.webhook import WebhookClient
>        import ssl
>        ssl_context = ssl.create_default_context()
>        ssl_context.check_hostname = False
>        ssl_context.verify_mode = ssl.CERT_NONE
>        webhook = WebhookClient(hook, ssl=ssl_context)
>        webhook.send(text=msg)
>        return True
>    $$ LANGUAGE plpython3u;
>    On Mon, Nov 1, 2021 at 3:06 PM Ni Ne <nineoften@hotmail.com> wrote:
> 
>      Would I recompile the plpython package or postgres itself?

[skipped]






view thread (9+ messages)  latest in thread

Message-ID: <20211102063158.GB1678439@azor.tzirechnoy.ru>
Permalink:  ../20211102063158.GB1678439@azor.tzirechnoy.ru/
Also on:    postgresql.org/message-id/20211102063158.GB1678439@azor.tzirechnoy.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: ilan@tzirechnoy.com, pgsql-admin@lists.postgresql.org
  Subject: Re: How to control which Python interpreter Postgres uses?
  In-Reply-To: <20211102063158.GB1678439@azor.tzirechnoy.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox