Skip to main content

KV provides a dictionary-like interface on top of SQLite.

Project description

https://github.com/mgax/kv/actions/workflows/ci.yml/badge.svg?branch=master

KV provides a dictionary-like interface on top of SQLite. Keys can be unicode strings, numbers or None. Values are stored as JSON.

>>> from kv import KV
>>> db = KV('/tmp/demo.kv')
>>> db['hello'] = 'world'
>>> db[42] = ['answer', 2, {'ultimate': 'question'}]
>>> dict(db)
{42: [u'answer', 2, {u'ultimate': u'question'}], u'hello': u'world'}

There is a locking facility that uses SQLite’s transaction API:

>>> with kv.lock():
...   l = db[42]
...   l += ['or is it?']
...   db[42] = l

And that’s about it. The code is really simple.

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

kv-0.4.1.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

kv-0.4.1-py3-none-any.whl (3.7 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