sqlite3
A full SQL database in a single file, built into Python.
Easy
import sqlite3
con = sqlite3.connect("lab.db")
con.execute("create table if not exists r (t real, v real)")
con.execute("insert into r values (?, ?)", (0.1, 3.3)) # always use placeholders
con.commit()
con.execute("select avg(v) from r").fetchone()
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.