Skip to main content

Python bindings for leveldb database library

Project description

py-leveldb: Python bindings for LevelDB (http://code.google.com/p/leveldb/) author: Arni Mar Jonsson (arnimarj@gmail.com)

Build Instructions

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

$ ./compile_leveldb.sh

Then, the extension itself:

$ python setup.py build

And, optionally, install it:

$ sudo python setup.py install

Example Usage

>>> import leveldb
>>> db = leveldb.LevelDB('./db')
>>> db.Put('hello', 'world')
>>> print db.Get('hello')
world
>>> db.Delete('hello')
>>> db.Get('hello')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError
>>> 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.

Source Distribution

leveldb-0.1.tar.gz (107.4 kB view details)

Uploaded Source

File details

Details for the file leveldb-0.1.tar.gz.

File metadata

  • Download URL: leveldb-0.1.tar.gz
  • Upload date:
  • Size: 107.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for leveldb-0.1.tar.gz
Algorithm Hash digest
SHA256 2a0eec12d399cabf86e722496891474233acb00891ef7287b323301dbe35b03b
MD5 68fc8f50ddb4afe3ebbe060cb52fb3c3
BLAKE2b-256 43e48709b23b9ec0c8101c3db6d7798a043e882331328f8548cb85dab00a27cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page