Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Index a leveldb with tuples

Project Description

Jigfyp is a query-builder for leveldb. It lets you specify leveldb ranges as tuples of strings.


Initalize a Jigfyp with a LevelDB object.

import leveldb, Jigfyp

db = leveldb.LevelDB()
j = jigfyp.Jigfyp(db)

Working with individual keys

The key in these examples is b'one!two!three'.

j.put_one((b'one', b'two', b'three'), b'Hi')
j.get_one((b'one', b'two', b'three'))
j.delete_one((b'one', b'two', b'three'))

Working with ranges of keys

Here’s one way of adding a few records.

j.put_one((b'one', b'two', b'three'), b'Hi')
j.put_one((b'one', b'two', b'four'), b'Hi')
j.put_one((b'one', b'two', b'seven), b'Hi')
j.put_one((b'over', b'nine', b'thousand'), b'Hi')

If you’re writing several records, you can use the put_many method to save the same data but with a leveldb.WriteBatch, which is usually faster.

records = [
    ((b'one', b'two', b'three'), b'Hi'),
    ((b'one', b'two', b'four'), b'Hi'),
    ((b'one', b'two', b'seven), b'Hi'),
    ((b'over', b'nine', b'thousand'), b'Hi'),

The cool part is the get_many and delete_many methods. With these, you specify a partial key, and everything that starts with that key is emitted. Consider a database containing the four above records. If we pass no arguments to get_many, we’ll read all the data.


If we pass (b'one', b'two'),

j.get_many(b'one', b'two')

we’ll get three records with these keys

* ``(b'one', b'two', b'three')``
* ``(b'one', b'two', b'four')``

and not the record with these keys

  • (b'one', b'two', b'seven)
  • (b'over', b'nine', b'thousand')

Similarly, if we run the following command,


we delete all the records whose keys begin with b'one', leaving us with a single record in the database, with the key (b'over', b'nine', b'thousand').

Release History

Release History

This version
History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
jigfyp-0.0.1.tar.gz (2.2 kB) Copy SHA256 Checksum SHA256 Source Aug 13, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting