The SQLite workbench

Pyodide, print, files, Run, Reset, and privacy.

The SQLite app is a Python editor that runs in WebAssembly (Pyodide). sqlite3 is in the standard library.

Goal

Connect, insert one city, and print the row.

Run

import sqlite3
con = sqlite3.connect(":memory:")
print(con.execute("SELECT sqlite_version()").fetchone())
con.close()
import sqlite3
con = sqlite3.connect("kiosk.db")
con.execute("CREATE TABLE IF NOT EXISTS t (x INTEGER)")
con.execute("INSERT INTO t VALUES (1)")
con.commit()
print(con.execute("SELECT * FROM t").fetchall())
con.close()

Reset restores the starter snippet. kiosk.db stays on the file chips if you wrote it.