Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/d3m3vilurr/py-leveldb
py-leveldb svn mirror
https://github.com/d3m3vilurr/py-leveldb
Last synced: 5 days ago
JSON representation
py-leveldb svn mirror
- Host: GitHub
- URL: https://github.com/d3m3vilurr/py-leveldb
- Owner: d3m3vilurr
- License: other
- Created: 2011-09-19T00:59:53.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-11-29T01:19:28.000Z (about 13 years ago)
- Last Synced: 2024-12-10T14:49:33.803Z (26 days ago)
- Language: C++
- Homepage: http://code.google.com/p/py-leveldb/
- Size: 145 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
py-leveldb: Python bindings for LevelDB (http://code.google.com/p/leveldb/)
author: Arni Mar Jonsson ([email protected])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 "", line 1, in
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)
>>>