pgqueuer
Pgqueuer is a Python library leveraging PostgreSQL for efficient job queuing.
What it is and what it does
PgQueuer is a Python job queue library that uses your PostgreSQL database as the backing store instead of requiring a separate message broker. You define job handlers as async functions decorated with @pgq.entrypoint, enqueue jobs from your application code, and run workers via the CLI. Jobs live in the same database as your application data, so you can enqueue a job and insert related records in a single transaction—if the transaction rolls back, the job never lands, eliminating dual-write drift.
The library uses PostgreSQL's LISTEN/NOTIFY for instant job dispatch and FOR UPDATE SKIP LOCKED to ensure jobs are never double-processed. It supports cron-style scheduling, deferred execution, per-entrypoint concurrency limits, Prometheus metrics, and a live dashboard. For testing and prototyping, PgQueuer.in_memory() provides a drop-in replacement that runs without a database. Runtime dependencies are anyio, croniter, pydantic, pydantic-settings, tabulate, typer, and uvloop.
Use it for:
- Enqueue background tasks transactionally alongside your business data in a single database transaction.
- Schedule recurring jobs using cron expressions without deploying a separate scheduler service.
- Run integration tests and prototypes using the in-memory queue adapter without a database.
- Monitor queue health and job throughput in real time using the built-in dashboard.
- Process jobs with guaranteed ACID semantics because the queue and your application data share the same database.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PgQueuer turns PostgreSQL into a background job queue, letting you enqueue, schedule, and process jobs transactionally within your existing database instead of running a separate message broker.
Yes. PgQueuer is actively maintained, permissively licensed (MIT), has no known vulnerabilities, and solves a real problem: if you already run PostgreSQL, you can eliminate a separate message broker and gain transactional consistency. The low install friction and support for modern Python versions (3.10+) make it straightforward to adopt. Start with the in-memory mode for testing, then move to PostgreSQL for production.
Install
pgqueuer on PyPI
pip
pip install pgqueueruv
uv add pgqueuerpoetry
poetry add pgqueuerInstalling pgqueuer
Before you install
Low friction: pure Python wheel with seven runtime dependencies. Active maintenance—last commit 2026-08-01, released 2026-07-27, 1517 GitHub stars. Targets Python 3.10+.
License in practice
MIT licensed (permissive). No restrictions on commercial or proprietary use; you may modify and distribute freely under the same license.
Quickstart
pip install pgqueuer
from pgqueuer import PgQueuer
from pgqueuer.db import AsyncpgDriver
from pgqueuer.models import Job
async def main():
pgq = PgQueuer(AsyncpgDriver(connection))
@pgq.entrypoint("my_job")
async def process(job: Job):
print(f"Processing: {job}")
await pgq.qm.queries.enqueue("my_job", b"payload")
Requires PostgreSQL 12+ and an existing database connection; jobs are durable only when backed by a real PostgreSQL database (in-memory mode is for testing only).
Verify before relying
- Whether the dashboard (pgq dashboard command) requires additional dependencies or setup beyond the base install.
- Performance characteristics and throughput limits under high concurrency or large job volumes.
- Exact retry and backoff behavior when jobs fail, and whether custom executors are required for production retry strategies.
- Which database drivers (asyncpg, psycopg async/sync) are included or require separate installation.
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 7 — anyio, croniter, pydantic-settings, pydantic, tabulate, typer, uvloop |
| Maintenance | actively maintained — 18 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 261,920/month — #8,380 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pgqueuer-1.3.2-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
saqSAQ is an async job queue framework that runs…
permissive · top 15,000 on PyPI
faktoryA Python worker and client library for Faktory,…
permissive · top 15,000 on PyPI
rq-schedulerAdds job scheduling capabilities to RQ (Redis…
permissive · top 15,000 on PyPI
arqarq provides a job queue system for Python that…
permissive · top 5,000 on PyPI
django-background-tasksDjango Background Tasks is a database-backed…
permissive · top 15,000 on PyPI
asyncpgasyncpg is an asyncio-native PostgreSQL client…
permissive · top 1,000 on PyPI
bullmqBullMQ for Python is a Redis-backed job queue…
permissive · top 5,000 on PyPI
rqRQ is a Python library for queueing jobs and…
permissive · top 5,000 on PyPI
absurd-sdkPython SDK for Absurd, a PostgreSQL-based…
permissive · top 15,000 on PyPI
django-tasksProvides a backport of Django's built-in Tasks…
permissive · top 5,000 on PyPI