I'm trying to write a service that will receive updates from Postgres DB when several tables changed. I'm writing it in Python using psycopg2 library. I have found several examples of a very simple solution - using PUBLICATION and SUBSCRIPTION but it doesn't provide an option to choose what tables should trigger service notification. It's all or nothing.
There is a Pglogical - an extension to Postgres that provides an ability to define a subset of tables that should generate update, but it looks like it can be used to sync two databases, I have'n found any way to connect to pglogical node to receive notification using psycopg2.
I have done the following:
replication_test=> CREATE EXTENSION pglogical;
then
select pglogical.create_node(node_name := 'provider', dsn := 'host=** port=5432 dbname=replication_test');
then
select pglogical.create_replication_set('first', True, True, True, False);
Now I'm wondering how can I connect to this Node to receive updates on table first
from Python code running as Lambda or EC2 instance.