Skip to main content

django-db-connection-pool

MySQL & Oracle & PostgreSQL connection pool backends of Django, Be based on SQLAlchemy.

Quickstart

  1. 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]
    
  2. Configuration

    • 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
              }
              ...
           }
       }
      

      Here's explanation of these options(from SQLAlchemy's Doc):

      • pool_size: The size of the pool to be maintained, defaults to 5. This is the largest number of connections that will be kept persistently in the pool. Note that the pool begins with no connections; once this number of connections is requested, that number of connections will remain. pool_size can be set to 0 to indicate no size limit; to disable pooling, use a :class:~sqlalchemy.pool.NullPool instead.

      • max_overflow: The maximum overflow size of the pool. When the number of checked-out connections reaches the size set in pool_size, additional connections will be returned up to this limit. When those additional connections are returned to the pool, they are disconnected and discarded. It follows then that the total number of simultaneous connections the pool will allow is pool_size + max_overflow, and the total number of "sleeping" connections the pool will allow is pool_size. max_overflow can be set to -1 to indicate no overflow limit; no limit will be placed on the total number of concurrent connections. Defaults to 10.

      or you can use dj_db_conn_pool.setup to change default arguments(for each pool's creation), before using database pool:

      import dj_db_conn_pool
      dj_db_conn_pool.setup(pool_size=100, max_overflow=50)
      

Metadata

Release files for django-db-connection-pool-plus 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-db-connection-pool-plus 1.0.7
File Size Uploaded
django-db-connection-pool-plus-1.0.7.tar.gz 5.8 kB Details

Release files / django-db-connection-pool-plus-1.0.7.tar.gz

Download URL django-db-connection-pool-plus-1.0.7.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d0926a0df5920e08a37285a68611bf115da0135191442ac5f1b435cbcdfd82ac
BLAKE2b-256 checksum
How to use checksums
3d0f2882554927220c4e07964aeb438bcd91b35f40701348d1de823e65db0e46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.5.0

Release history Release notifications | RSS feed

This release

1.0.7 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page