Re: How to control which Python interpreter Postgres uses?

Поиск
Список
Период
Сортировка
От Ilya Anfimov
Тема Re: How to control which Python interpreter Postgres uses?
Дата
Msg-id 20211102063158.GB1678439@azor.tzirechnoy.ru
обсуждение исходный текст
Ответ на Re: How to control which Python interpreter Postgres uses?  (Wells Oliver <wells.oliver@gmail.com>)
Список pgsql-admin
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]




В списке pgsql-admin по дате отправления:

Предыдущее
От: Ilya Anfimov
Дата:
Сообщение: Re: How to control which Python interpreter Postgres uses?
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: How to control which Python interpreter Postgres uses?