Skip to main content

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)

Source distribution for msqlite 0.0.6
File Size Uploaded
msqlite-0.0.6.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for msqlite 0.0.6
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

1.0.0

2 release files

0.7.2

2 release files

0.7.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page