Skip to main content

Simple dict-like class for TinyDB

Project description

tinydb-dict

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
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 hashes
Filename, size tinydb-dict-0.1.2.tar.gz (2.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page