AsyncAlchemy
A thin async wrapper for SQLAlchemy sessions.
Besides being async, the wrapper manages the context of the session for the execution block.Commits incoming changes if successfull or rolls back changes if an exceptions occurs.
Note: The upcoming SQLAlchemy 1.4 version will include built-in async functionality, it's recommended to upgrade to it once it's released.
Install
Pip
pip install asyncalchemy
From Source
The project uses poetry for dependency management and packaging.
To run from source clone project and:
pip install poetry
poetry install
Usage
Basic Example
from asyncalchemy import create_session_factory
# Create AsyncAlchemy session factory
session_factory = create_session_factory(db_uri, Base)
# Create session
async with session_factory() as session:
await session.query(Something).filter_by(something="else")
Example With Extra Params
from sqlalchemy.pool import NullPool
from asyncalchemy import create_session_factory
# Create session factory with additional SQLAlchemy params
session_factory = create_session_factory(db_uri, Base, poolclass=NullPool)
# Create session
async with session_factory() as session:
await second_session.add(Something)
await second_session.flush()
# Reuse session
async with session_factory(reuse_session=session) as second_session:
await session.delete(Something)
Metadata
Release files for asyncalchemy 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| asyncalchemy-1.1.4.tar.gz | 8.3 kB | Without provenance | Details for asyncalchemy-1.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| asyncalchemy-1.1.4-py3-none-any.whl | Python 3 | none | any | Details for asyncalchemy-1.1.4-py3-none-any.whl |
Total release size: 17.5 kB
Release files / asyncalchemy-1.1.4.tar.gz
| Download URL | asyncalchemy-1.1.4.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1e6a8493954e5bbf7a4e6cc603975e13b87424b412c57d00641be52dbec8236
|
|
BLAKE2b-256 checksum How to use checksums |
4a847e5388040577ff21a618bb8622aeddc825e445c7f0a2de8f899e7159eb76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
|
Release files / asyncalchemy-1.1.4-py3-none-any.whl
| Download URL | asyncalchemy-1.1.4-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4d56fa01b8a351d74b7074188783e2fd06f3457e14c0d30655fb39060d758c1c
|
|
BLAKE2b-256 checksum How to use checksums |
d202027dbe49d587cf89c0f77fa5e7b2bc91ed5efa8536d3148f47c490a7620f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
|
Security for asyncalchemy 1.1.4
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.