Skip to main content

Python bindings for leveldb database library

Project description

py-leveldb: Python bindings for LevelDB ( author: Arni Mar Jonsson (

Build Instructions

First of all, you need to build the included leveldb library:

$ ./

Then, the extension itself:

$ python build

And, optionally, install it:

$ sudo python install

Example Usage

>>> import leveldb
>>> db = leveldb.LevelDB('./db')
>>> db.Put('hello', 'world')
>>> print db.Get('hello')
>>> db.Delete('hello')
>>> db.Get('hello')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
>>> for i in xrange(10):
...   db.Put(str(i), 'string_%s' % i)
>>> print list(db.RangeIter(key_from = '2', key_to = '5'))
[('2', 'string_2'), ('3', 'string_3'), ('4', 'string_4'), ('5', 'string_5')]
>>> batch = leveldb.WriteBatch()
>>> for i in xrange(1000):
...   db.Put(str(i), 'string_%s' % i)
>>> db.Write(batch, sync = True)

Project details

Download files

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

Files for leveldb, version 0.11
Filename, size File type Python version Upload date Hashes
Filename, size leveldb-0.11.tar.gz (225.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page