r/django • u/mochama254 • 4h ago
walbox: react to PostgreSQL changes from Python
I built this because I wanted to react to PostgreSQL changes from Python without polling, without triggers, and without pulling in a whole CDC platform.
It consumes PostgreSQL logical replication and exposes committed transactions as an async stream in Python.
What it does:
- Keeps a durable checkpoint. If the process dies, it resumes from the last transaction it actually finished, not the last one it started.
- Bounded delivery queue, so a slow handler doesn't let memory grow without limit.
- Reconnects automatically after the connection drops.
- One dependency: psycopg3.
The transactional outbox is one use case, but it works with any published table.
GitHub: https://github.com/mochams/walbox
Curious to hear where this wouldn't fit your setup, or what's missing if you've solved this problem a different way.
4
Upvotes
3
u/memeface231 3h ago
This must be amazing for some people. I just setup views which trigger celery tasks to handle changes, even works for bulk inserts and updates which don't trigger signals. Many ways to Rome right?