Skip to main content

Simple dict-like class for TinyDB

Project description

tinydb-config

Simple dict-like class for TinyDB

Usage

from tinydb import TinyDB
from tinydb.storages import MemoryStorage
from tinydb_dict import TinyDBDict

# Pass any TinyDB argument to TinyDBDict
config = TinyDBDict('db.json')
config = TinyDBDict(storage=MemoryStorage)

# Then use it as a dictionary
config['key'] = 1
config['key']  # 1
config['key'] = 2
config['key']  # 2
config['unknown_key']  # KeyError: 'unknown_key'

# You can also pass a TinyDB instance
db = TinyDB('db.json')
config = TinyDBDict(tinydb=db)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tinydb-dict-0.1.1.tar.gz (1.9 kB view hashes)

Uploaded Source

Built Distribution

tinydb_dict-0.1.1-py3-none-any.whl (1.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page