Graph Synchronization

You can use the FlashbackSynchronizer API to automatically apply changes made to graph in the database to the corresponding PgxGraph object in memory, thus keeping both synchronized.

1graph = session.read_graph_by_name('BANK_GRAPH_VIEW','pg_view')
2synchronizer = graph.create_synchronizer(
3    graph_config=graph.config,
4    jdbc_url=self.jdbc_url,
5    username=self.username,
6    password=self.password
7)
8
9graph = synchronizer.sync()

Note that the Synchronizer object needs to be created only once per session. Once created, you can perform the synchronizer.sync() operation multiple times to generate the latest graph snapshot that is consistent with the changes in the database. Also note that the synchronizer.sync() invocation in the preceding code, fetches the changes and applies them in one call, but you can also encode a more complex update logic by splitting this process into separate fetch() and apply() invocations.

1synchronizer.fetch()
2...
3graph = synchronizer.apply()