Skip to main content

Simple dict-like class for TinyDB

Project description


Simple dict-like class for TinyDB


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

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

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

# You can also pass a TinyDB instance
db = TinyDB('db.json')
db_dict = 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.

Files for tinydb-dict, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size tinydb_dict-0.1.2-py3-none-any.whl (2.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size tinydb-dict-0.1.2.tar.gz (2.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page