cysqlite - a new sqlite driver

18 points by coleifer


simonw

I got this working as a compiled WebAssembly wheel that works in Pyodide in a browser - here's a demo page that runs the tests: https://simonw.github.io/research/cysqlite-wasm-wheel/demo.html

The wheel is here: https://simonw.github.io/research/cysqlite-wasm-wheel/cysqlite-0.1.4-cp311-cp311-emscripten_3_1_46_wasm32.whl

You can load that in the Pyodide REPL and try it out here: https://tools.simonwillison.net/pyodide-repl

import micropip
await micropip.install("https://simonw.github.io/research/cysqlite-wasm-wheel/cysqlite-0.1.4-cp311-cp311-emscripten_3_1_46_wasm32.whl")
import cysqlite
cysqlite.connect(":memory:").execute("select sqlite_version()").fetchone()
simonw

This is really exciting! I'm a longtime fan of pysqlite3 and I've always wanted custom Table-valued functions, looks like this gives me exactly that.

natfu

Uh, the in_transaction being True after .commit() is cursed in autocommit=True, I didn't know about. Seems like using the connection context manager is safer.

ngoldbaum

You should upload free-threaded cp314t wheels! See https://py-free-threading.github.io for more info but I’m also happy to help.