Skip to main content

serp-sqlite

Embedded SQLite for Serpentine. Runtime-backed ([R]): native builds load the system SQLite library dynamically at first use — winsqlite3.dll (shipped with Windows 10+) or sqlite3.dll on Windows, libsqlite3.so.0 on Linux, libsqlite3.dylib on macOS — no link-time dependency. Under CPython the same imports delegate to the stdlib sqlite3 module in autocommit mode.

from serp_sqlite import (connect, close, execute, prepare, bind_int,
                         bind_text, step, col_int, col_text, finalize)

db: int = connect("app.db")
execute(db, "CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)")

st: int = prepare(db, "INSERT INTO users (name) VALUES (?)")
bind_text(st, 1, "ada")
step(st)
finalize(st)

q: int = prepare(db, "SELECT id, name FROM users ORDER BY id")
while step(q):
    print(col_int(q, 0), col_text(q, 1))
finalize(q)
close(db)

API

Handles are opaque ints.

  • connect(path) -> int, close(db)
  • execute(db, sql) — one statement, no result rows
  • changes(db) -> int, last_rowid(db) -> int
  • prepare(db, sql) -> int
  • bind_int/bind_float/bind_text/bind_blob(stmt, idx, v), bind_null(stmt, idx) — 1-based ? parameters
  • step(stmt) -> bool — True while a row is available
  • column_count(stmt) -> int
  • col_type(stmt, i) -> int — 1=INTEGER, 2=FLOAT, 3=TEXT, 4=BLOB, 5=NULL (0-based columns)
  • col_int/col_float/col_text/col_blob(stmt, i)
  • reset(stmt) — rewind, keeping bindings; finalize(stmt)

SQLite errors surface as ValueError carrying the SQLite error message (e.g. no such table: users) in both worlds.

Usage rules

  • Call column getters only after a step that returned True, and use the getter matching col_type — cross-type getters are not guaranteed to agree between worlds.
  • Call column_count after the first step (the CPython delegate defers execution to the first step).
  • execute takes exactly one statement; use multiple calls for scripts.
  • If no SQLite library can be found natively, calls raise OSError("SQLite library not found").

Metadata

Release files for serp-sqlite 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for serp-sqlite 0.2.0
File Size Uploaded
serp_sqlite-0.2.0.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for serp-sqlite 0.2.0
File Interpreter ABI Platform
serp_sqlite-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.1 kB

Release files / serp_sqlite-0.2.0.tar.gz

Download URL serp_sqlite-0.2.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a48cf27dae8553172312dc251ff02bb0298cb1fa9dd244af880990437b49f690
BLAKE2b-256 checksum
How to use checksums
542304873a0301126627b74edaeb684940f0c7f635cc951314a8c4cb4a37ce67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / serp_sqlite-0.2.0-py3-none-any.whl

Download URL serp_sqlite-0.2.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3afb2bce2a0ca8fab557b2eb83daeb6834dd6989beb38ac34f2a85cad4fd8d1
BLAKE2b-256 checksum
How to use checksums
35d6dd3d6cbef65d444dc17189f4d5caf1488c85b86edf23a33792591eb5162b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

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