I'm trying to use the with-as construct with CachingMiddleware, following example in docs, but this throws "AttributeError: exit" - what am I doing wrong? Thanks!
from tinydb import TinyDB, where, database
from tinydb.middlewares import CachingMiddleware
from tinydb.storages import JSONStorage
db = TinyDB('tinydb_test.json', storage=CachingMiddleware(JSONStorage))
with database as db:
db.insert({'key':'keymaster', 'value':'gatekeeper'})