Skip to main content

Python event framework using PostgreSQL listen/notify

Project description

pgevents

Build Status Coverage Status Code style: black

Python event framework using PostgreSQL listen/notify

Example Usage

from pgevents import App

dsn = "dbname=test user=test password=test host=localhost"
channel = "foo"     # Postgres channel to listen for notifications on
topic = "bar"       # Event topic for handler to respond to

app = App(dsn, channel)


@app.register(topic)
def handler(context):
    print("Handling event")


app.run()

Create an event entry

INSERT INTO events (topic)
VALUES('bar');

Then send a notification by running the following SQL:

NOTIFY foo;

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pgevents-0.0.12.tar.gz (5.6 kB view hashes)

Uploaded Source

Built Distribution

pgevents-0.0.12-py3-none-any.whl (9.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page