Skip to content
This repository was archived by the owner on Nov 22, 2026. It is now read-only.

mojo-sqlite v0.1.1

Choose a tag to compare

@amarbarosys amarbarosys released this 21 Oct 09:24
· 21 commits to main since this release

mojo-sqlite v0.1.1

Released: 2026-10-21 · Commit: the one tagged v0.1.1 · Previous: v0.1.0

What it does

SQLite for Mojo that returns the same rows as Python's sqlite3, byte for byte, and
runs 2.7× faster on inserts and 4× to 5.5× faster on scans. It loads the system
libsqlite3.so.0 at run time, so it needs no linker flags.

from sqlite import Database

def main() raises:
    var db = Database("jobs.db")
    var q = db.prepare("SELECT id, cmd FROM jobs WHERE prio >= ?")
    q.bind(1, 10)
    while q.step():
        print(q.int(0), q.text(1))

Highlights

  • Database(path, read_only=True) opens an existing database for reading only.

Changes

Added

  • read_only=True on Database: opens with SQLITE_OPEN_READONLY. A write raises
    (attempt to write a readonly database), and a missing file raises instead of being
    created. Useful beside another process that owns the file, for example a monitor
    reading a live job database.

Verified

Check Result
scripts/check.sh: oracle on 39 statements, api test (now with read_only asserts), example PASS all
tests/api.mojo read_only: read works, write raises, missing file raises and is not created pass

Known limits

  • Linux only (libsqlite3.so.0), as in v0.1.0.

Upgrade / run

git pull && uv sync

No API change for existing code: read_only defaults to False.

Commits

  • v0.1.1 feat(sqlite): v0.1.1, Database(read_only=True)