Persistence and Serialization Modules

dbm.sqlite3

Provides a DBM-style mapping backed by SQLite, introduced in Python 3.13. It stores keys and values as bytes and supports basic mapping operations. It does not expose a relational query interface; use sqlite3 directly for tables and SQL queries.

Formal Syntax & Structure

python syntaxpython
import dbm.sqlite3

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
import dbm.sqlite3from tempfile import TemporaryDirectoryfrom pathlib import Pathwith TemporaryDirectory() as folder:    path = str(Path(folder)/"store")    with dbm.sqlite3.open(path, "n") as db:        db[b"count"] = b"3"    with dbm.sqlite3.open(path, "r") as db:        print(db[b"count"].decode("ascii"))
Python Reference