https://github.com/labteral/easyrocks
A python-rocksdb wrapper for a more comfortable interaction with RocksDB
https://github.com/labteral/easyrocks
library python rocksdb
Last synced: about 1 year ago
JSON representation
A python-rocksdb wrapper for a more comfortable interaction with RocksDB
- Host: GitHub
- URL: https://github.com/labteral/easyrocks
- Owner: labteral
- License: gpl-3.0
- Created: 2019-07-03T10:21:13.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-12-28T21:08:52.000Z (over 4 years ago)
- Last Synced: 2025-02-07T20:42:38.238Z (over 1 year ago)
- Topics: library, python, rocksdb
- Language: Python
- Homepage: https://pypi.org/project/easyrocks/
- Size: 51.8 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# easyrocks
A [`python-rocksdb`](https://github.com/twmht/python-rocksdb) wrapper for a more comfortable interaction with RocksDB.
> Keys must be of type `bytes`. Values can be nested structures or complex objects. Value serialization is automatically performed with MessagePack if possible, otherwise with Pickle.
## Usage
```python
from easyrocks import RocksDB
db = RocksDB(path='./rocksdb', read_only=False)
key = b'key1'
db.put(key, 'one')
db.get(key)
db.exists(key)
for key, value in db.scan(prefix=None, start_key=None, stop_key=None, reversed_scan=False):
print(key, value)
```
## Utils
There are some useful functions to transform a key to and from `bytes`:
```python
from easyrocks.utils import (
str_to_bytes
bytes_to_str
int_to_bytes
bytes_to_int
str_to_padded_bytes
int_to_padded_bytes
)
```