TinyDB is a small document-oriented database in pure Python with no external server, aimed at simple apps and local JSON storage.
Overview
TinyDB stores documents represented as Python dictionaries and fits projects that do not need a full SQL engine or a separate database server. It is written in pure Python without dependencies from PyPI and without an external server like PyMongo requires.
The API centers on the TinyDB class, insert and search operations, and a Query object for filtering with logical combinations, negation, regex, and custom tests. Multiple named tables live inside one database file. Storage backends are pluggable, and middleware such as caching layers can wrap default JSON storage.
The project is in maintenance mode: it is considered mature and stable, with ongoing releases for bug fixes and community contributions rather than large architectural changes. It runs on modern Python and PyPy3.
For small tools, prototypes, and apps that only need local structured storage in a single file, TinyDB offers a minimal in-process option compared with heavier database stacks.
Key features
- Document-oriented dict storage
- Pure Python, no PyPI dependencies
- Query language with logic operators
- Multiple tables per database
- Custom storage backends
- Caching middleware
- JSON file storage default
- No external database server
Use cases
- Small app local data
- Prototypes without SQL
- Single-file JSON databases
- Embedded configuration stores
- Lightweight persistence layers