Skip to content

A Python package to listen to Postgres events and receive the payload as JSON.

Notifications You must be signed in to change notification settings

waseem18/pgnotify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pgnotify

Python package to set triggers and listen to events from a Postgres database and receive the payload as JSON.

pgnotify will call the specified callback function whenever there is any event from the table(s) specified in the JSON.

Installation

pgnotify can be installed using pip

pip install pgnotify

Example

Here's an example on how to use pgnotify to specify the tables on which triggers are to be setup and how to pass callback function to receive the JSON payload.

Sample payload is shown below :

{'table': 'users', 'schema': 'public', 'op': 'INSERT', 'data': {'username': 21}, 'timestamp': 1527701379.0146108}

which includes

  1. The table on which the change was made on
  2. The schema type
  3. The operation
  4. The data change
  5. The timestamp of the event

License

MIT

About

A Python package to listen to Postgres events and receive the payload as JSON.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages