Skip to main content
https://badge.fury.io/py/flask-sqlalchemy-pgevents.svg https://coveralls.io/repos/github/shawalli/flask-sqlalchemy-pgevents/badge.svg?branch=master https://img.shields.io/badge/License-MIT-yellow.svg

flask-sqlalchemy-pgevents provides PostGreSQL eventing for Flask. It handles setting up the underlying database, registering triggers, and polling for events.

Why Do I Care?

I have SQLAlchemy, which supports event listeners. Why do I care about this extension?

SQLAlchemy’s event listening framework is great for listening to database changes made through SQLAlchemy. However, in the real world, not every data event that affects a database takes place through SQLAlchemy; an application may be created from any number of packages, libraries, and modules written in different languages and with different frameworks. If any of these non-SQLAlchemy items modify a database, SQLAlchemy will not know, and will therefore not notify event listeners of these changes.

With this extension, an application may be notified of events at the database layer. This means that any changes made to a table are caught by this extension and registered event listeners (for the affected table) are called.

Why Use SQLAlchemy?

You just said that SQLAlchemy has nothing to do with the eventing aspect of this extension…So why are you using SQLAlchemy?

Great question! SQLAlchemy is primarily used as a convenience mechanism for creating a consistent connection to the database.

Additionally, many Flask applications use SQLAlchemy as their ORM. As such, this extension will integrate seamlessly with any Flask applications that use Flask-SQLAlchemy. To provide a consistent SQLAlchemy experience, this extension’s event listener decorator is designed to closely resemble SQLAlchemy event listener decorators.

Note

While this extension may appear to integrate with SQLAlchemy’s event listeners, it actually sits alongside that eventing structure. Registering a PGEvents event listener does not register the event listener with SQLAlchemy’s event registrar.

Examples

See the examples directory for example use cases for this package.

Future Plans

  • With a little bit of work, it should be possible to completely integrate this extension’s event listeners into SQLAlchemy.event, so that event listeners are functionally identical to SQLAlchemy’s event listeners.

  • Currently, the only supported events are after-insert and after-update. The psycopg2-pgevent package could be updated in coordination with this extension to support other SQLAlchemy mapper events.

References

Authorship and License

Written by Shawn Wallis and distributed under the MIT license.

Release files for flask-sqlalchemy-pgevents 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-sqlalchemy-pgevents 0.3.0
File Size Uploaded
flask-sqlalchemy-pgevents-0.3.0.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-sqlalchemy-pgevents 0.3.0
File Interpreter ABI Platform
flask_sqlalchemy_pgevents-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size:12.6 kB

Release files / flask-sqlalchemy-pgevents-0.3.0.tar.gz

Download URL flask-sqlalchemy-pgevents-0.3.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bc9aecd966d71a70dd016a9f7376bc74e11eda239b6ff9b7d8153f850b1f9bba
BLAKE2b-256 checksum
How to use checksums
9789a4f3ed1d64078c305f8f1c95100a40b35cf0183fbec5e505e710c305b2d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.7.8 Linux/5.3.0-1032-azure

Release files / flask_sqlalchemy_pgevents-0.3.0-py3-none-any.whl

Download URL flask_sqlalchemy_pgevents-0.3.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3530013a6bffcf29f6aee452860ab3a6b312323ebcd3f407924b705ad522580f
BLAKE2b-256 checksum
How to use checksums
4422937f4db7e3de3eee73def30d641fd5e4eff8cb9f0a7c27b8d4d7d09ae24e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.7.8 Linux/5.3.0-1032-azure

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page