AsyncIO RethinkDB connection pool
async-repool is a Python library which provides a asyncio-based connection pool management for accessing a RethinkDB database. async-repool creates and maintains a configurable pool of active connection to a RethinkDB database. These connections are then available individually through a basic API.
Internally, repool uses the Python AsyncIO Queue class which is not thread-safe. This means that the same connection pool cannot be share between several threads, please, use asyncio with process workers instead.
This is just asyncio-based clone of repool.
Installation
async-repool is available as a python library on Pypi. Installation is very simple using pip :
$ pip install async_repool
This will install async-repool as well as rethinkdb dependency.
Basic usage
A new connection pool using default connection configurations can simply be created by:
from async_repool import AsyncConnectionPool
pool = AsyncConnectionPool(dict()) # Required argument is kwargs for R.connect function
await pool.init_pool()
conn = await pool.acquire() #returns a Connection instance
await r.table('heroes').run(conn) #do RethinkDB stuff
# ...
pool.release(conn) #put back connection to the pool
await pool.release_pool() #release pool (close rethinkdb connections)
# ...
async with pool.connect() as conn1:
# do something with conn1
# pool.release(conn1) is automatically called after leaving the with code block
Optional arguments
AsyncConnectionPool creation accepts a number of optional arguments:
pool_size: set the pool size, ie. the number of connections opened simultaneously (default=3).connection_ttl: set the connection time to live. Connections older than TTL are automatically closed and re-opened when acquire (default=3600 seconds, set to 0 for disable)
Metadata
Release files for async-repool 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| async_repool-1.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for async_repool-1.0.1-py2.py3-none-any.whl |
Release files / async_repool-1.0.1-py2.py3-none-any.whl
| Download URL | async_repool-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
3977026c173bb68f03963e71538e5c85ca61f0baf92abe96e550613de79bb0ed
|
|
BLAKE2b-256 checksum How to use checksums |
9cdeff971df70bf6828c7b0f7b2b456573893e2f0b793a52cd10b55c5f3bb77e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Security for async-repool 1.0.1
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.