sqlite3
Stdlib — DatabasePython 2.5+Intermediate
Built-in SQLite database interface; no server needed
Quick Info
- Documentation
- Official Docs
- Python Version
- 2.5+
- Dependencies
- None — Python Standard Library
- Install
Included with Python
Learn by Difficulty
Quick Example
python
import sqlite3 conn = sqlite3.connect(":memory:") cursor = conn.cursor() cursor.execute("CREATE TABLE users (name TEXT, age INTEGER)") cursor.execute("INSERT INTO users VALUES ('Alice', 30)") cursor.execute("INSERT INTO users VALUES ('Bob', 25)") cursor.execute("SELECT * FROM users") print(cursor.fetchall()) conn.close()
The sqlite3 module is part of Python's standard library. Built-in SQLite database interface; no server needed.
Try in PlaygroundTags
stdlibdatabasesqlpersistencefile-io
Related Items
sqlalchemy
Package — Database
SQL toolkit and ORM: engine, session, declarative models, query builder
peewee
Package — Database
Small, expressive ORM for SQLite, MySQL, PostgreSQL
csv
Stdlib — Serialization
Read and write CSV files
json
Stdlib — Serialization
Encode and decode JSON data
shelve
Stdlib — Serialization
Persistent dictionary backed by pickle and dbm
dbm
Stdlib — Database
Simple dictionary-like interface to DBM-style databases