TinyDB

active

by Markus Siemens and contributors · since 2013 · also known as tinydb

Pure-Python document store that keeps every table in one human-readable JSON file.

documentembedded libraryopen source (permissive)mature

Overview

TinyDB is a small document-oriented database written in pure Python with no dependencies. Documents are plain dicts grouped into tables inside a single JSON file (or held in memory), and you query them with a Python Query DSL instead of SQL. It shines in scripts, CLI tools, prototypes and small desktop apps where SQLite feels heavy or a diffable text file is handy. The trade-off is deliberate: the whole file is read into memory, there are no indexes, no ACID guarantees and no safe access from multiple processes or threads. Release 4.9.0 (August 2026) is current and requires Python 3.10 or newer.

Strengths & trade-offs

Strengths

  • +Zero dependencies and pure Python: pip install and go, on any platform CPython runs
  • +Data sits in a single readable JSON file you can inspect, diff or commit to git
  • +Pluggable storages and middlewares (e.g. in-memory storage, write caching) are easy to write
  • +Tiny, fully tested codebase that is easy to read and extend

Trade-offs

  • −No indexes: every query scans all documents in the table
  • −Entire database is loaded into memory and serialized on writes
  • −Not safe for concurrent access from multiple processes or threads (e.g. a Flask app)
  • −No transactions or ACID guarantees

Great for

  • +State and config storage for CLI tools and scripts
  • +Prototypes and test fixtures
  • +Small single-user desktop or hobby apps
  • +Collecting small scraped or logged datasets

Think twice for

  • −Web backends with concurrent requests
  • −Datasets larger than comfortably fit in RAM as JSON
  • −Workloads needing indexes, joins or transactions

Capabilities

Native or official first-party support · 3 of 25 tracked

✓JSON
✓In-memory
✓Durable persistence
–Transactions
–Joins
–Secondary indexes
–Full-text search
–Vector search
–Geospatial
–Change data capture
–Triggers
–Stored procedures
–Materialized views
–TTL / expiry
–Pub/Sub
–Columnar storage
–Compression
–Encryption at rest
–Role-based access
–Time travel
–Branching
–Online schema changes
–Streaming ingest
–Offline sync
–Runs in WebAssembly

Scale & consistency

Comfortable data size
Small · ≤ 100 GB
Horizontal scaling
None
Multi-region
No
Transactions
None
Consistency
Strong
Schema
Schemaless
Architecture
Embedded, Single node
Query languages
Python Query API

Whole database lives in memory and is rewritten to disk on change; comfortable up to a few MB to tens of MB.

Deployment

Self-hosted Vendor-managed cloud Serverless Embedded Edge Kubernetes operator

Ecosystem

apis & protocolsPython API
client languagesPython

Alternatives to TinyDB

Compare all→
SQLiteRelational75.5

The in-process SQL engine that ships in every phone, browser and OS: one file, zero servers.

tinydb vs sqlite →
lowdbDocument19.1

Tiny type-safe local JSON database for Node, Electron and the browser using plain JavaScript.

tinydb vs lowdb →
NeDBDocument13.3

Pure-JavaScript embedded datastore with a MongoDB-like API; the original is unmaintained.

tinydb vs nedb →
ZODBObject22.7

Transparent persistence for Python objects with ACID transactions and history.

tinydb vs zodb →
UnQLiteKey-Value4.1

Embedded, transactional key-value and JSON document engine in a single C file, with Jx9 scripting.

tinydb vs unqlite →
NitriteDocument2.7

Embedded NoSQL document store for Java and Android with pluggable MVStore or RocksDB storage.

tinydb vs nitrite →

TinyDB FAQ

What is TinyDB?

TinyDB is a document database by Markus Siemens and contributors, first released in 2013. TinyDB is a small document-oriented database written in pure Python with no dependencies. Documents are plain dicts grouped into tables inside a single JSON file (or held in memory), and you query them with a Python Query DSL instead of SQL. It shines in scripts, CLI tools, prototypes and small desktop apps where SQLite feels heavy or a diffable text file is handy. The trade-off is deliberate: the whole file is read into memory, there are no indexes, no ACID guarantees and no safe access from multiple processes or threads. Release 4.9.0 (August 2026) is current and requires Python 3.10 or newer.

Is TinyDB open source?

Yes. TinyDB is open source. License: MIT License.

Does TinyDB support ACID transactions?

No. TinyDB does not provide ACID transactions; its consistency model is strong.

Does TinyDB scale horizontally?

TinyDB does not scale horizontally; it runs on a single node, so you scale it up rather than out. It is comfortable at small scale (≤ 100 GB).

How can I run TinyDB?

You can self-host it and embed it in your application.

What is TinyDB best for?

TinyDB is a strong fit for state and config storage for CLI tools and scripts; prototypes and test fixtures; and small single-user desktop or hobby apps. Think twice for web backends with concurrent requests.

What are the best alternatives to TinyDB?

Common alternatives to TinyDB include SQLite, lowdb, NeDB, ZODB and UnQLite. The right choice depends on your workload, scale and hosting; WhichDB's smart match ranks them against your requirements.

How popular is TinyDB?

TinyDB ranks #139 of 844 databases on the WhichDB Score (21.3/100), and #17 among document databases. The score combines public adoption signals such as package downloads, GitHub activity, job posts and developer discussion.