Beaver
Embedded database for Python · MIT

The Swiss army knife of local data.

Dicts, lists, queues, logs, searchable documents, vectors, graphs, blobs, locks and channels, all in one SQLite file. No server to run, nothing to configure.

$ pip install beaver-db
v2.4.1 · Python 3.12+ · MIT
Beaver logo: a beaver with a Swiss army knife in front of a database
One file, many shapes

Pick the shape your data has.

Each manager is a name inside the same app.db. Every snippet below runs as is after pip install beaver-db.

dict.pybeaver-db 2.4.1 · runs as isGuide →
from beaver import BeaverDB

db = BeaverDB("app.db")
config = db.dict("config")
config["theme"] = "dark"
config.set("session", {"user": "ana"}, ttl_seconds=3600)
print(config["theme"], len(config))
dark 2

The file is standard SQLite: open it with any SQLite tool. Python's own sqlite3 module reads all its tables.

Grows with you

Start with a script. Keep the file.

1A script

Open a file and use it. The same API exists as async, with await.

db = BeaverDB("app.db")
2Many processes

Workers share app.db: a queue hands out jobs, a lock keeps one-at-a-time work, a channel tells the others.

jobs = db.queue("jobs")
3The shell

Read and write dicts, lists, queues and logs from the command line.

beaver --db app.db dict config get theme
4Over the network

Serve the file over REST and connect with the same API. Dicts, lists, queues and logs today.

beaver serve --db app.db --api-key "$KEY"beaver.connect(url, api_key=key)Deployment guide →
Always start beaver serve with --api-key. Without it the server has no authentication, so keep it on 127.0.0.1 (the default).
In production at Syalia

Syalia builds its own products on Beaver. It is open source under the MIT licence, and contributions are welcome on GitHub.