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 details)

Uploaded Source

Built Distribution

kv-0.4.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file kv-0.4.1.tar.gz.

File metadata

  • Download URL: kv-0.4.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.8 Darwin/22.1.0

File hashes

Hashes for kv-0.4.1.tar.gz
Algorithm Hash digest
SHA256 0e30ced1b2f57888763e3930174404d1a1bdd969069ae1abe76ead3aee1c73d5
MD5 14a75e3893000c140628c812176d8ec2
BLAKE2b-256 fa86aa368360866a86f68190171c32dd25ccc5d8430bedd86846f7150010076a

See more details on using hashes here.

File details

Details for the file kv-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: kv-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.10.8 Darwin/22.1.0

File hashes

Hashes for kv-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 819df9b48d942ffebcf7af56ec2c4b7f4c76af156518275f6e43c604d04178d5
MD5 4d64380cfc3b678cc9ec96f650cd3a85
BLAKE2b-256 0f1da5732ee0905afa00744e2d837dd1fb0bd4e28c379f001f611eeebaec442f

See more details on using hashes here.

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