anysqlite3
anysqlite3 is a wrapper around sqlite3 that allows you to interact with SQLite databases from async code.
It is built on top of the built-in sqlite3 module and is compatible with both asyncio and trio code.
Installation
pip install anysqlite3
Usage
anysqlite3 provides essentially the same API as the built-in sqlite3 module, but with async versions of most methods.
import anyio # or asyncio or trio
import anysqlite3
async def main():
async with await anysqlite3.connect(":memory:") as db:
await db.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)")
await db.execute("INSERT INTO users (name) VALUES (?)", ("Alice",))
await db.execute("INSERT INTO users (name) VALUES (?)", ("Bob",))
async for row in db.execute("SELECT * FROM users"):
print(row)
anyio.run(main())
Transactions
anysqlite3 provides a context manager for transactions.
Use this instead of the database's commit and rollback methods.
Transactions hold a lock on the database, so you should always use them in a with block.
async with db.transaction() as t:
await db.execute("INSERT INTO users (name) VALUES (?)", ("Charlie",))
await t.rollback()
await db.execute("INSERT INTO users (name) VALUES (?)", ("David",))
await t.commit()
License
This project is licensed under the MIT License - see LICENSE.txt for details.
Metadata
Release files for anysqlite3 0.0.1
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 |
|---|---|---|---|---|
| anysqlite3-0.0.1.tar.gz | 3.4 kB | Without provenance | Details for anysqlite3-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anysqlite3-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for anysqlite3-0.0.1-py3-none-any.whl |
Total release size: 7.6 kB
Release files / anysqlite3-0.0.1.tar.gz
| Download URL | anysqlite3-0.0.1.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eaf18d12acc5420a238df0486e1acfe2cd94d7abd6b4b5a9fa61b43f80d70860
|
|
BLAKE2b-256 checksum How to use checksums |
d860a62ea2bdbd5ca5ef65b121843b1909bfdbf5ac8754ae0cdcfc29930e0599
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.0
|
Release files / anysqlite3-0.0.1-py3-none-any.whl
| Download URL | anysqlite3-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e725cee3db8e487c6534c03f8b9e9174ecca5f2356c5d03086bc19075fb33f17
|
|
BLAKE2b-256 checksum How to use checksums |
6643733a22d891466ebf8f15aaf4bdc0ca4ad62c98db99e0bf127d017da8f7fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.0
|
Security for anysqlite3 0.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.