Change Data Capture from PostgreSQL WAL to RabbitMQ
Project description
dbqueue
A lightweight, modular, and reliable CDC (Change Data Capture) library based on PostgreSQL WAL → RabbitMQ.
- Logical Replication: Captures changes instantly via PostgreSQL WAL (Write-Ahead Log).
- RabbitMQ Integration: Automatically routes changes to a RabbitMQ exchange.
- Robust: Includes automatic reconnection and exponential backoff strategies against connection drops.
- Pluggable: Support for
wal2jsonorpgoutput(Postgres 10+ native) plugins.
Requirements
- Python 3.10+
- PostgreSQL 10+ (
wal_level = logicalmust be set) - RabbitMQ
Installation
pip install dbqueue
Usage
from dbqueue import DBQueueWatcher
def main():
watcher = DBQueueWatcher(
db_dsn="postgresql://user:pass@localhost:5432/dbname",
rabbit_url="amqp://guest:guest@localhost:5672/",
slot_name="my_cdc_slot",
publication="my_cdc_pub",
event_format="debezium_like" # or "simple"
)
# You can also use it as a consumer if you wish
@watcher.on_insert("users")
def handle_user_insert(event):
print(f"New user: {event['after']}")
# Publishes and runs defined handlers
watcher.start()
if __name__ == "__main__":
main()
Postgres Settings
Make sure the following setting is present in postgresql.conf:
wal_level = logical
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
dbqueue-0.1.0.tar.gz
(13.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
dbqueue-0.1.0-py3-none-any.whl
(15.2 kB
view details)
File details
Details for the file dbqueue-0.1.0.tar.gz.
File metadata
- Download URL: dbqueue-0.1.0.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b512c3bd4bd3cf86743cd08f345d5319d02ca035f652fe373a61682d237ba62c
|
|
| MD5 |
fdd5f877687f4263639c1690513634f5
|
|
| BLAKE2b-256 |
79ab76bed99165d5482a8c7c7a6a38e286de37c9a17549c39565a9c7cbcbc303
|
File details
Details for the file dbqueue-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dbqueue-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8eb766b2412752027ee05da8fdd4b27fdeb71452b508ea34ccc70ade143f1a5
|
|
| MD5 |
4e36c620dee74db822debd549047528d
|
|
| BLAKE2b-256 |
2f698d8d3bae54182181ff25a049ae07697110b098bcb8eabab69a93cf685102
|