A thread-pooled sqlite3 for asyncio.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sqlitepool-0.0.0.tar.gz
(4.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqlitepool-0.0.0.tar.gz.
File metadata
- Download URL: sqlitepool-0.0.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6dc79eb16b9a3476ba04a5fcb2ca07c77a1fa89853f8d1dde881c21fb2e1ee14
|
|
| MD5 |
f690f0153aa386a9e3b5abff0c9dc5e9
|
|
| BLAKE2b-256 |
5440e1d35356229e5dab9206011eb493d7b5e952816f7d71da1f4b6bf11b761e
|
File details
Details for the file sqlitepool-0.0.0-py3-none-any.whl.
File metadata
- Download URL: sqlitepool-0.0.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bccee860890b223c02f3307420b882cb13fae696a3e35a63d6d0f635508496b
|
|
| MD5 |
2b7b2fd9909bec17c20a448ebb9a0dc6
|
|
| BLAKE2b-256 |
62484b3f782b712127fe13716da4e4f7a64646707b9d67a55010e76c2a8f91a2
|