Re: python async with psycopg2 - Mailing list pgsql-general

From Daniele Varrazzo
Subject Re: python async with psycopg2
Date
Msg-id CA+mi_8ZwUmSR37y3pSZA733=LDvm386Jh3O7x9BD=i+9enSdfg@mail.gmail.com
Whole thread Raw
In response to python async with psycopg2  (Rita <rmorgan466@gmail.com>)
List pgsql-general
On Fri, 17 Jul 2020 at 20:44, Rita <rmorgan466@gmail.com> wrote:>

>     curs = conn.cursor()
>     curs.execute("LISTEN mychan0;")
>     #curs.execute("LISTEN mychan1;") #fails!
>     wait_select(conn)

Maybe you have to wait_select after each execute.

This example could be helpful.
https://www.psycopg.org/docs/advanced.html#asynchronous-notifications
Note that you don't need an async connection to receive notification:
a sync one, as long as is in autocommit and you are using an I/O
completion function to wait for readiness, works as well.

-- Daniele



pgsql-general by date:

Previous
From: Rita
Date:
Subject: python async with psycopg2
Next
From: Adrian Klaver
Date:
Subject: Re: About compress in pg_dump