skip to navigation
skip to content

Not Logged In

kv 0.2

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

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.

 
File Type Py Version Uploaded on Size
kv-0.2.zip (md5) Source 2012-10-18 3KB
  • Downloads (All Versions):
  • 0 downloads in the last day
  • 46 downloads in the last week
  • 227 downloads in the last month