from tinydb import TinyDB, where
from tinydb.storages import JSONStorage, Storage
from tinydb.middlewares import CachingMiddleware, Middleware
db = TinyDB('db1.json', storage=CachingMiddleware(JSONStorage))
print db.all()
[]
db.insert({'test': 1})
db.close()
print db.all()
[{'test': 1}]