Skip to main content

Postgresql + PostGIS Connection Pooling for Django.

Project description

This project was based on django-postgrespool + django-postgrespool2(forked) (both are not working in my production env) and django-db-pool(outdated as fck).

Django-DBPool

This is a simple Postgres Connection Pooling backed for Django 1.4+ (possibly, haven’t checked), powered by SQLAlchemy and psycopg2.

Usage

Using Django-PostgresPool is simple, just set django_postgrespool as your connection engine:

DATABASES = {
    'default': {
        'ENGINE': 'django_postgrespool'

If you’re using the dj-database-url module:

import dj_database_url

DATABASES = {'default': dj_database_url.config(engine='django_postgrespool')}

If you’re using south:

SOUTH_DATABASE_ADAPTERS = {
    'default': 'south.db.postgresql_psycopg2'
}

Everything should work as expected.

Installation

Installing Django-PostgresPool is simple, with pip:

$ pip install django-dbpool

Configuration

Optionally, you can provide additional options to pass to SQLAlchemy’s pool creation:

DATABASE_POOL_ARGS = {
    'max_overflow': 10,
    'pool_size': 5,
    'recycle': 300
}

Here’s a basic explanation of two of these options:

  • pool_size – The minimum number of connections to maintain in the pool.

  • max_overflow – The maximum overflow size of the pool. This is not the maximum size of the pool.

The total number of “sleeping” connections the pool will allow is pool_size. The total simultaneous connections the pool will allow is pool_size + max_overflow.

As an example, databases in the Heroku Postgres starter tier have a maximum connection limit of 20. In that case your pool_size and max_overflow, when combined, should not exceed 20.

Check out the official SQLAlchemy Connection Pooling docs to learn more about the optoins that can be defined in DATABASE_POOL_ARGS.

Django 1.3 Support

django-postgrespool currently supports Django 1.4 and greater. See this ticket for 1.3 support.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-dbpool-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_dbpool-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file django-dbpool-0.1.0.tar.gz.

File metadata

  • Download URL: django-dbpool-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.2

File hashes

Hashes for django-dbpool-0.1.0.tar.gz
Algorithm Hash digest
SHA256 83e56652bb040950673b51911fae8b136b63c1fd2374ec954dc7b6c9743beda7
MD5 e5574037c059c22f10d9dfa22f7bee3e
BLAKE2b-256 9dc40e2dda5d4851833b0fc6fdc74995c3592b0e49f951958751e9583c67d6e9

See more details on using hashes here.

File details

Details for the file django_dbpool-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: django_dbpool-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.2

File hashes

Hashes for django_dbpool-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb2822a85fe01a13165fb428c3fa1e0f55e62afd6662c03a19f98cddb7307f6c
MD5 54067440481a7337a079f3f737887076
BLAKE2b-256 abed535cc484fb19ff95b0f11301753b7a93669384d40187d1d818b6a5dcc2cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page