msqlite
Multi-threaded/multi-process support on top of SQLite. The intent is to ensure a SQL statement
will get executed, even if other threads or processes are trying to access the DB. Avoids
database is locked issues.
No additional package dependencies beyond regular Python.
Intended for relatively simple SQL statement execution. Locks the DB file on every access, with built-in retry mechanism.
Even though the DB is locked on every access, typically simple writes are much less than 1 second (more like 1 mS), so this latency is still usable for many use cases.
import time
from pathlib import Path
from msqlite import MSQLite
db_path = Path("temp", "example.sqlite")
db_path.parent.mkdir(exist_ok=True)
with MSQLite(db_path) as db:
# create DB file in case it doesn't already exist
db.execute(f"CREATE TABLE IF NOT EXISTS stuff(id INTEGER PRIMARY KEY, name, color, year)")
now = time.monotonic_ns() # some index value
# insert some data
db.execute(f"INSERT INTO stuff VALUES ({now}, 'plate', 'red', 2020), ({now + 1}, 'chair', 'green', 2019)")
# read the data back out
response = db.execute(f"SELECT * FROM stuff")
for row in response:
print(row)
Release files for msqlite 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| msqlite-0.0.6.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| msqlite-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / msqlite-0.0.6.tar.gz
| Download URL | msqlite-0.0.6.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3cb2c07545afdb8ec3cc060443ecdc3c7f2275438e6ac0f948455b1a1b6f02a2
|
|
BLAKE2b-256 checksum How to use checksums |
3b29d7c4f2ce729fd4b015a6f829746f15142ed24aa3fbe4b0ed771388e0522f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.8
|
Release files / msqlite-0.0.6-py3-none-any.whl
| Download URL | msqlite-0.0.6-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
72f544ac2df436cea2ad6f6eb442ccb6e568bc1635cd36d2a48ed9c900193f8a
|
|
BLAKE2b-256 checksum How to use checksums |
07d32ee2a932657570072975f7211db637fbd1cd8c54527853d52a38e0537e28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.8
|