django-db-connection-pool
Database connection pool component library for Django
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-pooluv
uv add django-db-connection-poolpoetry
poetry add django-db-connection-poolInstalling 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
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
dj-database-urlParses DATABASE_URL environment variables into…
permissive · top 5,000 on PyPI
sqlalchemy-jdbcapiSQLAlchemy dialect for JDBC and ODBC database…
permissive · top 15,000 on PyPI
DBUtilsDBUtils provides pooled, persistent database…
permissive · top 5,000 on PyPI
psycopg2-poolManages a pool of reusable PostgreSQL…
copyleft · top 15,000 on PyPI
psycopg-poolProvides a connection pool for Psycopg 3,…
copyleft · top 1,000 on PyPI
django-db-geventpoolProvides a gevent-based connection pool for…
permissive · top 15,000 on PyPI
django-sequencesProvides gapless sequence generation for Django…
permissive · top 15,000 on PyPI
pondpondPond is an object-pooling library that manages…
unclear · top 15,000 on PyPI
databasesProvides async database access for PostgreSQL,…
permissive · top 5,000 on PyPI
connection_poolProvides a thread-safe connection pool that…
permissive · top 15,000 on PyPI