Skip to main content

Python bindings for LevelDB. Python 2-3 compatible

Project description

# ctypes bindings for LevelDB 

The existing three [LevelDB](http://code.google.com/p/leveldb/) interfaces ([py-leveldb](http://code.google.com/p/py-leveldb/), [cpy-leveldb](https://github.com/forhappy/cpy-leveldb), [plyvel](https://github.com/wbolster/plyvel/)) use the Python C API and compile Python modules that work with LevelDB's C++ interface. This Python module simply uses the ctypes library to LevelDB's C interface - making it more portable across Python implementations and easier to install and distribute.

lvldb:
* Python 2-3 compatible
* supports get/put/delete (with standard read/write options)
* supports bloom filters
* supports leveldb LRU cache
* allows for manual or automatic database closing (compare with py-leveldb)
* provides write batches
* provides iterators (full control of leveldb iteration, with additional idiomatic python iterator support)
* provides prefix-based iteration (returns iterators that work as if all keys with a shared prefix had the prefix stripped and were dumped into their own database)
* provides scoped sub-databases (presents a new database wrapper backed by an existing database with all keys prefixed by some prefix)
* provides range iterators (for idioms like give me all keys between start and end)
* provides an in-memory db implementation (for faster unit tests)
* supports snapshots
* fits in one file
* requires no compilation

## Sample Usage

```
# Python3
import lvldb

db = lvldb.DB("/path/to/db", create_if_missing=True)
db.put("key1", "value1")
db.put("key2", "value2")
print(f"key1 => {db.get('key1')} ")

for key, value in db:
print(f"{key} => {value}")
```

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

lvldb-0.1.2.tar.gz (14.5 kB view hashes)

Uploaded Source

Built Distribution

lvldb-0.1.2-py3-none-any.whl (10.3 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