skillfed

pgqueuer

Pgqueuer is a Python library leveraging PostgreSQL for efficient job queuing.

pgqueuer v1.3.2 261.9K downloads/30d#8,380 on PyPI1,517
Permissive license MIT License Active released

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 pgqueuer

uv

uv add pgqueuer

poetry

poetry add pgqueuer

Installing 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

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: AsyncIOIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: DatabaseTopic :: Software Development :: Libraries :: Python ModulesTopic :: System :: Distributed ComputingTopic :: Utilities

Tags

postgresql job queuebackground job processingasync task queue pythondatabase-backed job schedulerpostgres worker queuetransactional job enqueuecron scheduling postgres
job-queuepostgres-nativeasync-tasks

More Python Modules packages