From: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> |
---|---|
To: | Rita <rmorgan466(at)gmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: python async with psycopg2 |
Date: | 2020-07-17 20:07:26 |
Message-ID: | CA+mi_8ZwUmSR37y3pSZA733=LDvm386Jh3O7x9BD=i+9enSdfg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, 17 Jul 2020 at 20:44, Rita <rmorgan466(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2020-07-17 20:18:09 | Re: About compress in pg_dump |
Previous Message | Rita | 2020-07-17 19:44:26 | python async with psycopg2 |