Skip to content

mgax/kv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

81052c7 · Dec 3, 2022

History

47 Commits
Nov 30, 2022
Nov 10, 2017
Nov 15, 2017
Oct 3, 2012
Oct 3, 2012
Nov 30, 2022
Nov 25, 2022
Dec 3, 2022
Nov 30, 2022
Nov 30, 2022
Nov 30, 2022
Nov 30, 2022

Repository files navigation

KV - simple key/value store

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.

About

Simple key-value store backed by sqlite

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages