zauberparacelsus / fakedb

Just a quick and dirty way to persist dictionaries, with conflict protection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FakeDB

Just a quick and dirty way to persist dictionaries for Python 3.2 or higher. Can persist data as either json, bson, or hjson. Conflict resolution is performed with a revision key, blocking a write if an existing document and a modified version do not have matching revision keys.

from fakedb import FakeDB

db = FakeDB()
data = {"content":"hello world!"}
db.write(data, "test")

data = db.read("test")
data["content"] = "foo bar"
db.write(data, "test")

About

Just a quick and dirty way to persist dictionaries, with conflict protection

License:MIT License


Languages

Language:Python 100.0%