Database connection pool component library for Django
Low maintenance activity. Last release 19 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and recent releases.
pip install django-db-connection-pooldjango-db-connection-pool
:star: If this project is helpful to you, please light up the star, Thank you:smile:
MySQL & Oracle & PostgreSQL & JDBC (Oracle, OceanBase) connection pool components for Django, Be based on SQLAlchemy. Works fine in multiprocessing and multithreading django project.
Quickstart
Installation
Install with pip with all engines:
$ pip install django-db-connection-pool[all]
or select specific engines:
$ pip install django-db-connection-pool[mysql,oracle,postgresql,jdbc]
or one of mysql,oracle,postgresql,jdbc
$ pip install django-db-connection-pool[oracle]
Update settings.DATABASES
MySQL
change django.db.backends.mysql to dj_db_conn_pool.backends.mysql:
DATABASES = {
'default': {
'ENGINE': 'dj_db_conn_pool.backends.mysql'
}
}
Oracle
change django.db.backends.oracle to dj_db_conn_pool.backends.oracle:
DATABASES = {
'default': {
'ENGINE': 'dj_db_conn_pool.backends.oracle'
}
}
PostgreSQL
change django.db.backends.postgresql to dj_db_conn_pool.backends.postgresql:
DATABASES = {
'default': {
'ENGINE': 'dj_db_conn_pool.backends.postgresql'
}
}
Pool options(optional)
you can provide additional options to pass to SQLAlchemy's pool creation, key's name is POOL_OPTIONS:
DATABASES = {
'default': {
'POOL_OPTIONS': {
'POOL_SIZE': 10,
'MAX_OVERFLOW': 10,
'RECYCLE': 24 * 60 * 60
}
}
}
django-db-connection-pool has more configuration options
here: PoolContainer.pool_default_params
Here's the explanation of these options(from SQLAlchemy's Doc):