databases icon indicating copy to clipboard operation
databases copied to clipboard

Async LISTEN/NOTIFY support?

Open mecampbellsoup opened this issue 4 years ago • 2 comments

Is it possible to listen for asynchronous PG notifications using this library? Is that functionality supported?

  • https://www.postgresql.org/docs/9.1/sql-listen.html
  • https://www.postgresql.org/docs/9.1/sql-notify.html

mecampbellsoup avatar Aug 09 '21 14:08 mecampbellsoup

Yes, you have to use connection.raw_connection then call add_listener as per asyncpg docs: https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.connection.Connection.add_listener

circlingthesun avatar Feb 03 '22 11:02 circlingthesun

Yep exactly we ended up dropping down to the asyncpg API.

mecampbellsoup avatar Feb 03 '22 13:02 mecampbellsoup