Rocksdb Python Binding
Project description
RocksDict
Key-value storage supporting any python object
Introduction
This library has two purposes.
- As an on-disk key-value storage solution for Python.
- As a RocksDB interface.
These two purposes operate in different modes:
-
Default mode, which allows storing
int
,float
,bool
,str
,bytes
, and other python objects. -
Raw mode (
options=Options(raw_mode=True)
), which allows storing onlybytes
.
Installation
Wheels available, just pip install rocksdict
.
Examples
A minimal example
from rocksdict import Rdict
import numpy as np
import pandas as pd
path = str("./test_dict")
# create a Rdict with default options at `path`
db = Rdict(path)
db[1.0] = 1
db["huge integer"] = 2343546543243564534233536434567543
db["good"] = True
db["bytes"] = b"bytes"
db["this is a list"] = [1, 2, 3]
db["store a dict"] = {0: 1}
db[b"numpy"] = np.array([1, 2, 3])
db["a table"] = pd.DataFrame({"a": [1, 2], "b": [2, 1]})
# reopen Rdict from disk
db.close()
db = Rdict(path)
assert db[1.0] == 1
assert db["huge integer"] == 2343546543243564534233536434567543
assert db["good"] == True
assert db["bytes"] == b"bytes"
assert db["this is a list"] == [1, 2, 3]
assert db["store a dict"] == {0: 1}
assert np.all(db[b"numpy"] == np.array([1, 2, 3]))
assert np.all(db["a table"] == pd.DataFrame({"a": [1, 2], "b": [2, 1]}))
# iterate through all elements
for k, v in db.items():
print(f"{k} -> {v}")
# batch get:
print(db[["good", "bad", 1.0]])
# [True, False, 1]
# delete Rdict from dict
db.close()
Rdict.destroy(path)
An Example of Raw Mode
This mode allows only bytes as keys and values.
from rocksdict import Rdict, Options
PATH_TO_ROCKSDB = str("path")
# open raw_mode, which allows only bytes
db = Rdict(path=PATH_TO_ROCKSDB, options=Options(raw_mode=True))
db[b'a'] = b'a'
db[b'b'] = b'b'
db[b'c'] = b'c'
db[b'd'] = b'd'
for k, v in db.items():
print(f"{k} -> {v}")
# close and delete
db.close()
Rdict.destroy(PATH_TO_ROCKSDB)
More Examples on BatchWrite, SstFileWrite, Snapshot, RocksDB Options, and etc.
Go to example folder.
Limitations
Currently, do not support merge operation and custom comparator.
Full Documentation
Contribution
This project is still in an early stage of development. People are welcome to add tests, benchmarks and new features.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for rocksdict-0.2.16-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d813504f57711534435e3cf5ed1febf9df39a242fa10ddc6f670884685caf22 |
|
MD5 | a2ef159eee567788fbea3188f2f87650 |
|
BLAKE2b-256 | 1c3fb289a9f31845af0ee69c42f153f1e32bb428aa9096e6082402be098fed84 |
Close
Hashes for rocksdict-0.2.16-cp310-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 458b627026ef085ef9b4f9b1d36a0aa74ee0a01ec70002ed9524cbbf8b2d15cb |
|
MD5 | dfd25398ea65ccedd408a376f3e95166 |
|
BLAKE2b-256 | bec95599231ed0071b4eced2d870f90030ff9fb4d49650d2613a04f124068cc6 |
Close
Hashes for rocksdict-0.2.16-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87bb5b6960776e7e7ba3197536cc273fbde4b92679f93bf6bd474825d990a1d7 |
|
MD5 | 744a02293ce27f7e6eee1035d5203441 |
|
BLAKE2b-256 | 8fdbdfedde440416cfcef78f26c65bb9d1c1a807aa9bdbecd7d3e36d0f890778 |
Close
Hashes for rocksdict-0.2.16-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 833b1e7d6125fab6d92eaded723e0f3bec557cfe2e3f62663665304e56623a78 |
|
MD5 | fc8113efc49fe9c5708871e0cc8f3a9f |
|
BLAKE2b-256 | d6868ae461dbe2edb8d9ad39302770167e68a208f7c37c55d05577d921c519d8 |
Close
Hashes for rocksdict-0.2.16-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52f734f0e54ba283b981391c712cc1466a46567f44f2c691a417c6821a979559 |
|
MD5 | 3c047cc48d90f77fd152f01a1b0c3b0b |
|
BLAKE2b-256 | 4c67d5927534a7f2854b69da883883bcb75aeac473e806de80c77f5b0e4ab9b3 |
Close
Hashes for rocksdict-0.2.16-cp39-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f2e76bdaa69676c5416517a88b2b173f326cca19da6ecc574eeef08becaf45e |
|
MD5 | d1feb9254a9513abc3529ae6a2d049e5 |
|
BLAKE2b-256 | a56a2a465f48ffb9f2cfcd5337b6659b36458600b268f1bc426a58f3822cd239 |
Close
Hashes for rocksdict-0.2.16-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0e3c9bae29145ee58f14a9e2bea79e75d499d2e333628f281b05c4a1c2269cb |
|
MD5 | 386b90d0ae501ea4040fc84ae06f3443 |
|
BLAKE2b-256 | 756cf36578caa38571aaea003e5b83e79143e179c55b0c043d32e8062963e4d9 |
Close
Hashes for rocksdict-0.2.16-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d0d90b5b11fe46f1f6365abdd6b89805d529dcee39b3642abfc27a39c93b8c5 |
|
MD5 | 99ca20336cc4a0a502f94e266993b0d5 |
|
BLAKE2b-256 | 010767b984055c9f536a302984abae910030791e4f3f49ee38451620e4b84dfb |
Close
Hashes for rocksdict-0.2.16-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08647ae1f956c2c383ee49c0fa1d7f8c878bea34341d41d32dd892cf100e0015 |
|
MD5 | 4d1020d4d8e4fc7eb93303e79bba24a0 |
|
BLAKE2b-256 | fee4fffd19d42ea6bd958d2906fa1205503e6f3969ff3038aeebba98b3734835 |
Close
Hashes for rocksdict-0.2.16-cp38-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46a1d0c62b04bd4d39df45cf486d330ba7c1d3de38871dda9525d5e1d43bd998 |
|
MD5 | fbcf3f723ba028bf4ce39162a516f1d1 |
|
BLAKE2b-256 | c86c87c2df865a2a4294f4696a5ba95666208687e8fc4f7d09f8c6605d28c951 |
Close
Hashes for rocksdict-0.2.16-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d580e455cf3d843b3ab4864e3cf7c529949c5c1e3279559da9ab1c1a9f97b40d |
|
MD5 | 235067d2ff481fd45609ea3e258dcf98 |
|
BLAKE2b-256 | 7303beed4524ef49fa9c1ad511462114aee9611556ad8206fbd7d9a2200c5884 |
Close
Hashes for rocksdict-0.2.16-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 282b089ab713d82f67c447c601dbb4f0903d03547ccdb717333de0279facb1f6 |
|
MD5 | c10e77c57f0d4bffbf38bad40077cc64 |
|
BLAKE2b-256 | 9ea752e5a1b776060ea328c1e13aab4941ce3e6b22e943901abbe6f9fe1ea14f |
Close
Hashes for rocksdict-0.2.16-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78b0d153a5a00ff11b1c3144a5d6eade57f7c1db04565c47c3d0083559577b37 |
|
MD5 | 7928c754ff2d84b11432599c4e15e112 |
|
BLAKE2b-256 | f7f709272cbf5bfff4e17ef5736231279ba2cbba5b06847340f7d9dbdbb7b05e |
Close
Hashes for rocksdict-0.2.16-cp37-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe37720e4ad88beabf0f1795b1ab28baf972faa777cf6bb6d172c1d0a6e38e60 |
|
MD5 | 9ebed5e5fe9c5e52bebf5ddf3a73516d |
|
BLAKE2b-256 | 8a1d40f2ed01b4c3674ab31e7d719efea86cd5fd9e56a87fe11b460bc2101f8a |
Close
Hashes for rocksdict-0.2.16-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5733e5e8ed49572e308a0e440c6aa3b20100dd237a6c17585c68a667793d471c |
|
MD5 | 965fee2276bcde2ed69f92d03282c26b |
|
BLAKE2b-256 | 9e92368c534419a751f8a91dd6816815786477db5a1e8db35d69252445e957f3 |
Close
Hashes for rocksdict-0.2.16-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7700f81b25823c1ee14693da3db6625be6f0fb1f16756b6f5ed44ad66b19e911 |
|
MD5 | 3b5c381a938ce782f1ac7d4981bb1dc6 |
|
BLAKE2b-256 | 44da0c61dbaec3d7cd62cfc6fd18ae51704df92a81f7fcecb75bf386309c9e5f |
Close
Hashes for rocksdict-0.2.16-cp36-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd4956093cc5bf02454965e9e14ec56c4d7bd87b88e9eed20a079e4061bab23d |
|
MD5 | a04a8bc6f95c3c2e8aca54cfb6567fa0 |
|
BLAKE2b-256 | 0244add5ebfe42ba8824f76dc229e9892a0a4bbc4a48156911bc3f0ca81ab4d9 |
Close
Hashes for rocksdict-0.2.16-cp36-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b47e4890599e9cdbd67af7ed0e0fe4801e1705cb244a37ac06f19e30d74abb76 |
|
MD5 | 56f2832bbdb672173be0988bbabc2629 |
|
BLAKE2b-256 | fc859e20ced42d72c94bcc027459acb9662a9df9236d50d242b247f84f6d7d49 |
Close
Hashes for rocksdict-0.2.16-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9f0bcfb8aa5095f8902e656f955355c97cb85dbc9cd4511e0b195da69b77ad3 |
|
MD5 | f14c56778aa9a6c3396852f4edb687f8 |
|
BLAKE2b-256 | b84d37af2fbb0dc477a21d6849640da3abda58fe06b030564a9b9a23b8540fd5 |
Close
Hashes for rocksdict-0.2.16-cp36-cp36m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99d0a3e545365d6479b51bb4579c4a553d9f95c3c66c65d6df6a0fda3812ca13 |
|
MD5 | f6bb92d3dc8f9ebf0ba246953b2827c6 |
|
BLAKE2b-256 | d267196fa3226e6bd7ba72013a6b5c79db8887cba38af74ae229ea351a731ef8 |