skillfed

django-db-connection-pool

Database connection pool component library for Django

django-db-connection-pool v1.2.6 199.8K downloads/30d#9,700 on PyPI248
Permissive license MIT License Copyright (c) 2019 Altair Bow Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in… (full text in the JSON record) AGING released

What it is and what it does

django-db-connection-pool replaces Django's standard database backends with pooled alternatives that reuse connections across requests rather than creating new ones each time. It wraps SQLAlchemy's connection pool implementation and supports MySQL, Oracle, PostgreSQL, and JDBC-based databases (Oracle and OceanBase). The package is designed to work correctly in multiprocess environments like uWSGI, where each worker process maintains its own independent pool.

You configure it by changing your Django DATABASES ENGINE setting from the standard backend (e.g., `django.db.backends.mysql`) to the pooled equivalent (e.g., `dj_db_conn_pool.backends.mysql`), then optionally tune pool behavior via POOL_OPTIONS (pool size, overflow limit, connection recycling interval). The pool manages connection lifecycle automatically; you use Django's ORM and raw queries exactly as normal.

Use it for:

  • High-traffic Django applications where connection creation overhead becomes a bottleneck and connection reuse would reduce latency
  • Multiprocess deployments (uWSGI, Gunicorn with multiple workers) where each process needs its own pool to avoid connection conflicts
  • Projects using Oracle or PostgreSQL that benefit from tunable pool parameters like connection recycling for long-lived connections
  • JDBC-based database access (Oracle via JDBC, OceanBase) when native Python drivers are unavailable or unsuitable
  • Applications with bursty traffic patterns where MAX_OVERFLOW allows temporary connection spikes beyond the base pool size

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides connection pooling for Django database backends (MySQL, Oracle, PostgreSQL, and JDBC-based databases) using SQLAlchemy's pool implementation to manage persistent connections in multiprocess and multithreaded environments.

Yes, if you run Django with a database that benefits from connection pooling (especially Oracle, PostgreSQL, or MySQL under load) and can tolerate the aging maintenance status. The package is stable and has no known vulnerabilities, but expect slower response to new issues. Not necessary for low-traffic or development-only projects where connection overhead is negligible.

Install

django-db-connection-pool on PyPI

pip

pip install django-db-connection-pool

uv

uv add django-db-connection-pool

poetry

poetry add django-db-connection-pool

Installing django-db-connection-pool

Before you install

Low install friction; pure Python wheel. Maintenance status is aging—last commit was 466 days ago, though the repository remains active and the package is marked Production/Stable. Suitable for established projects but may see delayed responses to new issues.

License in practice

MIT License permits commercial and private use, modification, and redistribution with minimal restrictions. Requires only that the license notice be included in copies or substantial portions of the software.

Quickstart

pip install django-db-connection-pool[mysql]

# In Django settings.py
DATABASES = {
    'default': {
        'ENGINE': 'dj_db_conn_pool.backends.mysql',
        'POOL_OPTIONS': {
            'POOL_SIZE': 10,
            'MAX_OVERFLOW': 10
        }
    }
}

Requires Django and one of SQLAlchemy-compatible database drivers (mysql-connector-python, cx_Oracle, psycopg2, or JPype for JDBC). JDBC backend requires JAVA_HOME and CLASSPATH environment variables to be set.

Verify before relying

  • Performance impact of connection pooling on typical Django workloads compared to standard backends
  • Compatibility with Django versions beyond the current release cycle
  • Thread-safety guarantees under high concurrency in production deployments

Package facts

License MIT License Copyright (c) 2019 Altair Bow Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.0)
Install friction low — pure-Python wheel
Runtime dependencies 3 — Django, SQLAlchemy, sqlparams
Maintenance aging — 466 days since the last release
Last repo commit
First released
Downloads 199,818/month — #9,700 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_db_connection_pool-1.2.6-py3-none-any.whl

Keywords: django, db, database, persistent, connection, pool, pooling

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Software Development :: Libraries :: Python Modules

Tags

django database connection poolingmysql oracle postgresql connection pooldjango db connection reusemultiprocess django databasesqlalchemy pool djangopersistent database connections djangojdbc database pool django
connection-poolingmultiprocess-safe

More Python Modules packages