Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Simple key-value store backed by sqlite

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .gitignore
Octocat-spinner-32 CHANGES.rst
Octocat-spinner-32 COPYING.txt
Octocat-spinner-32 MANIFEST.in
Octocat-spinner-32 README.rst
Octocat-spinner-32 kv.py
Octocat-spinner-32 requirements-dev.txt
Octocat-spinner-32 setup.py
Octocat-spinner-32 tests.py
README.rst

KV - simple key/value store

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.

Something went wrong with that request. Please try again.