Python event framework using PostgreSQL listen/notify
Project description
pgevents
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(event):
print(f"Received event {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
Release history Release notifications | RSS feed
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.3.tar.gz
(4.8 kB
view details)
Built Distribution
File details
Details for the file pgevents-0.0.3.tar.gz
.
File metadata
- Download URL: pgevents-0.0.3.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b9e3e9ca9d8499873c7b86140bd0485c3e0e05b420b6924cc9df0ec47c4a3ae |
|
MD5 | f2801e8731a46a4e5e4a1a8ed9606112 |
|
BLAKE2b-256 | 49d8115027f9f2c9c7b25101b908640d67295c3cd2f3550eab0bb0824139c136 |
File details
Details for the file pgevents-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: pgevents-0.0.3-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e821866d99a690b4252b049f12b27ae629068a80f7d758a2a39cde1a97a1de09 |
|
MD5 | d1997963f5f9c5dcd58ea621a894f9a5 |
|
BLAKE2b-256 | 03d9c832cde5b01a67ada3c865d4518fb5a1b9cde782119a2de7e9e9780c68b5 |