Skip to main content

DBCP Lite

A simple, light and nearly featureless database connection pool for Python.

Connections are added to the pool as needed up to max_size in number. Once added the connections will remain in the pool and no attempt is made to shrink the pool. In most cases it is recommended to set min_size == max_size.

Usage

import cx_Oracle
from dbcp_lite import DBConnectionPool

connect_args = ('scott', 'tiger', 'dbhost.example.com/orcl')
pool = DBConnectionPool(cx_Oracle.connect, 
                        create_args=connect_args, 
                        create_kwargs={'threaded': False}, 
                        min_size=1, 
                        max_size=4, 
                        name='scott@orcl')

with pool.acquire() as connection:
    ...

with pool.acquire_cursor() as cursor:
    ...

pool.close()

The acquire_cursor() is a convenience method that returns a Cursor using a Connection from the pool. Upon successful completion commit() will be called on the Connection and the Cursor will be closed.

Timeouts

A timeout can be provided to various methods. If no connections are available to be acquired or closed the methods will raise a PoolTimeout exception.

Lifecycle Methods

The following lifecycle methods are called during normal operations and alternate implementations can be provided if needed to perform specialized setup or cleanup.

on_acquire(self, connection) - no-op

on_return(self, connection) - default implementation calls connection.rollback()

on_close(self, connection) - default implementation calls connection.close()

For example, to implement auto-commit:

pool = ...
pool.on_return = lambda x: x.commit()

Metadata

Release files for dbcp-lite 0.0.2

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

Source distribution (sdist)

Source distribution for dbcp-lite 0.0.2
File Size Uploaded Provenance Actions
dbcp-lite-0.0.2.tar.gz 8.0 kB Without provenance Details for dbcp-lite-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dbcp-lite 0.0.2
File Interpreter ABI Platform Actions
dbcp_lite-0.0.2-py3-none-any.whl Python 3 none any Details for dbcp_lite-0.0.2-py3-none-any.whl

Total release size: 16.0 kB

Release files / dbcp-lite-0.0.2.tar.gz

Download URL dbcp-lite-0.0.2.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
508e3e8e8ba20f9bf0b2f1e6bb6d7c0757866b16bdd6cbc1b2bda2a440c7b31c
BLAKE2b-256 checksum
How to use checksums
f47235453c6f2a00de2d1039ed630d12b0dc2d1578468e10c743fc67fb7e5728
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

Release files / dbcp_lite-0.0.2-py3-none-any.whl

Download URL dbcp_lite-0.0.2-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c9a1d991257d24d6128fbebafbf8fc6799300e87b533c5664f18a0bb290bbf6
BLAKE2b-256 checksum
How to use checksums
129a053bf09a696fa0fdb9b5d61241bb5ef2c70c27c60b168da06a3a0169d1ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

Security for dbcp-lite 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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