Skip to main content

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 wal2json or pgoutput (Postgres 10+ native) plugins.

Requirements

  • Python 3.10+
  • PostgreSQL 10+ (wal_level = logical must 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

Metadata

Release files for dbqueue 0.1.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 dbqueue 0.1.0
File Size Uploaded
dbqueue-0.1.0.tar.gz 13.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dbqueue 0.1.0
File Interpreter ABI Platform
dbqueue-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.1 kB

Release files / dbqueue-0.1.0.tar.gz

Download URL dbqueue-0.1.0.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b512c3bd4bd3cf86743cd08f345d5319d02ca035f652fe373a61682d237ba62c
BLAKE2b-256 checksum
How to use checksums
79ab76bed99165d5482a8c7c7a6a38e286de37c9a17549c39565a9c7cbcbc303
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / dbqueue-0.1.0-py3-none-any.whl

Download URL dbqueue-0.1.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8eb766b2412752027ee05da8fdd4b27fdeb71452b508ea34ccc70ade143f1a5
BLAKE2b-256 checksum
How to use checksums
2f698d8d3bae54182181ff25a049ae07697110b098bcb8eabab69a93cf685102
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.1.0 This release

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