SQLitePool
A thread-pooled sqlite3 for asyncio.
Behavior
stmt.execute()returnboolinstead of a cursor object:Trueif the query succeeds, orFalseotherwise- Empty results on
INSERT,UPDATE,DELETE, andSELECTare considered asFalse
Usage
import asyncio
from sqlitepool import ConnectionPool
async def main():
pool = ConnectionPool('example.db', size=5)
await pool.start()
try:
stmt = pool.prepare(
'CREATE TABLE IF NOT EXISTS users ('
' id INTEGER PRIMARY KEY,'
' name TEXT NOT NULL,'
' age INTEGER NOT NULL'
');'
)
await stmt.execute()
stmt = pool.prepare('INSERT INTO users (name, age) VALUES (?, ?)')
await stmt.execute(['Alice', 30])
stmt = pool.prepare('SELECT * FROM users LIMIT 10')
await stmt.execute()
row = await stmt.fetch()
while row:
print('*', row['name'], row['age'])
row = await stmt.fetch()
finally:
await pool.shutdown()
if __name__ == '__main__':
asyncio.run(main())
Install
python3 -m pip install --upgrade sqlitepool
License
MIT License
Release files for sqlitepool 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sqlitepool-0.0.0.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqlitepool-0.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.1 kB
Release files / sqlitepool-0.0.0.tar.gz
| Download URL | sqlitepool-0.0.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6dc79eb16b9a3476ba04a5fcb2ca07c77a1fa89853f8d1dde881c21fb2e1ee14
|
|
BLAKE2b-256 checksum How to use checksums |
5440e1d35356229e5dab9206011eb493d7b5e952816f7d71da1f4b6bf11b761e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / sqlitepool-0.0.0-py3-none-any.whl
| Download URL | sqlitepool-0.0.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8bccee860890b223c02f3307420b882cb13fae696a3e35a63d6d0f635508496b
|
|
BLAKE2b-256 checksum How to use checksums |
62484b3f782b712127fe13716da4e4f7a64646707b9d67a55010e76c2a8f91a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|