Welcome to python-rocksdb’s documentation!¶
Overview¶
Python bindings to the C++ interface of http://rocksdb.org/ using pybind11:
import pyrocksdb
db = pyrocksdb.DB()
opts = pyrocksdb.Options()
# for multi-thread
opts.IncreaseParallelism()
opts.OptimizeLevelStyleCompaction()
opts.create_if_missing = True
s = db.open(opts, '/path/to/db')
assert(s.ok())
# put
opts = pyrocksdb.WriteOptions()
s = db.put(opts, b"key1", b"value1")
assert (s.ok())
# get
opts = pyrocksdb.ReadOptions()
blob = db.get(opts, b"key1")
print (blob.data) # b"value1"
print (blob.status.ok()) # true
#delete
opts = pyrocksdb.WriteOptions()
s = db.delete(opts, b"key1")
assert(s.ok())
db.close()
Tested with python3.7
- python rocksdb API
- pyrocksdb.Blob
- pyrocksdb.ColumnFamilyHandle
- pyrocksdb.ColumnFamilyDescriptor
- pyrocksdb.VectorColumnFamilyDescriptor
- pyrocksdb.VectorColumnFamilyHandle
- pyrocksdb.IteratorWrapper
- pyrocksdb.DB
- pyrocksdb.DBOptions
- pyrocksdb.Options
- pyrocksdb.AdvancedColumnFamilyOptions
- pyrocksdb.ColumnFamilyOptions
- pyrocksdb.Options
- pyrocksdb.WriteOptions
- pyrocksdb.ReadOptions
- pyrocksdb.TransactionDBOptions
- pyrocksdb.TransactionOptions
- pyrocksdb.LRUCacheOptions
- pyrocksdb.Status
- pyrocksdb.WriteBatch
- pyrocksdb.transaction_db
- pyrocksdb.transaction_wrapper
- pyrocksdb.Snapshot
- Instructions how to install
- Tutorial
- Changelog
Contributing¶
Source can be found on github. Feel free to fork and send pull-requests or create issues on the github issue tracker