Show HN: Pub/Sub with PostgreSQL under 40 lines of Python code
gist.github.com
gist.github.com
I am curious if this is an approach folks actually use in production, though.
[0]: https://gist.github.com/zikani03/e4fa4f150940dbdb03a6761fd0c...
I must admit my DB knowledge is lacking. What is the purpose of setting the isolation level to autocommit?
> I wonder if you could use this in a Django project with Channels, and stream database changes over websocket to the client.I wonder if you could use this in a Django project with Channels, and stream database changes over websocket to the client.
That's exactly what I'm doing with this! :) But you don't even need channels for that! The point is to simplify the stack. > What is the purpose of setting the isolation level to autocommit?
Notifications are only sent after a transaction has been committed, see: https://www.postgresql.org/docs/12/sql-listen.htmlHere is an example in the psycopg2 documentation: https://www.psycopg.org/docs/advanced.html#asynchronous-noti...