Skip to main content

Key-Value interface over SQLite. Supports any datatype, including JSON and BLOB

Project description

Sqlite Kv

Async Key-Value interface over SQLite. Supports any datatype, including JSON and BLOB

Usage

Simplest is to use the SQKliteKV api

  • JSON documents

    from sqlite_kv import SQLiteKV
    
    api = await SQLiteKV.documents(db_path='mydb.sqlite', table='myjsons')
    # or, if you're sure the DB file already exists
    api = SQLiteKV.documents(db_path='mydb.sqlite', table='myjsons', create=False)
    await api.upsert('my-doc', dict(hello='world'))
    await api.read('my-doc') # dict(hello='world')
    
  • BLOBs

    from sqlite_kv import SQLiteKV
    
    api = await SQLiteKV.blobs(db_path='mydb.sqlite', table='myblobs')
    await api.upsert('my-image', b'<super big image>')
    await api.read('my-image') # b'...'
    
  • Any custom datatype (e.g. JSON, but manually)

    import json
    from sqlite_kv import SQLiteKV
    
    api = await SQLiteKV.new(
      db_path='mydb.sqlite', table='my-jsons',
      dtype='JSON', parse=json.loads, dump=json.dumps
    )
    await api.upsert('my-image', dict(hello='world'))
    await api.read('my-image') # dict(hello='world')
    

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-sqlite-sync-0.1.0.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

kv_sqlite_sync-0.1.0-py3-none-any.whl (4.2 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