Rocksdb Python Binding
Reason this release was yanked:
compatibility issue with v0.2.x
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 (withPickle
). -
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.
A Simple Benchmark
Compared to PyVidarDB and semidbm, which are all cross-platform key-value storage solutions.
Small Value: 100 byte value
sequetial insertion
sequential read
random read
Large Value: 100 kb value
sequetial insertion
sequential read
random read
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
Built Distributions
Hashes for rocksdict-0.3.1-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23955028e82ed9ae8237b4f638eb46c009e7b10b1412830d6bf734c526a71480 |
|
MD5 | 5c08136283c3bf7e51cd6be4b3f53922 |
|
BLAKE2b-256 | eb1c40b72d34499bfe73395874cbe3aff7634223cf84c66a40eac2fa574f2558 |
Hashes for rocksdict-0.3.1-cp311-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 721f86019becae9b82768010de5d25c387228f3664d780552104f778c76e1e51 |
|
MD5 | c297d132e8be283945abf05f06562363 |
|
BLAKE2b-256 | b91fc73b3b4ad68dc08c8deb7cb2362706ea9fc67f02ce641ced5ece30f130ae |
Hashes for rocksdict-0.3.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66611ee4816505900493c2cf3f88c6ff5dc846b92428d93b2f7035b6551cea46 |
|
MD5 | 178b719007df3adb0a0fbdd5f1c4a240 |
|
BLAKE2b-256 | 083a2e85fb996ddfca8d9e7b4534108799e138f1a83ac149f01fd131ae369d28 |
Hashes for rocksdict-0.3.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fba0f4c4a56b8d4c988e14c9c2a38c8d7f812a6baf4188f3c08ae2ea9ea74e5c |
|
MD5 | 57d165243e223412c91bb70d9f9384c9 |
|
BLAKE2b-256 | db0c4a856ce01040bb33ca46586d5074ed52bd45cb83e7f23a5ec1ed22abc941 |
Hashes for rocksdict-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29b1d37c60d29ff13f6bf5be66712445d26f323d552a8a5b9e2de75597e82289 |
|
MD5 | 0183461016ed425862796b23b046a50a |
|
BLAKE2b-256 | 608880e26db2d21485e6c0326b12d66e884e03a0c30bd26ad3bec75052ebced7 |
Hashes for rocksdict-0.3.1-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66d912ab8070b227644c5cd9181997547a32b3f65b861a3f439b322678ec1f2f |
|
MD5 | 86a1980176862f6ac9b41336579553dc |
|
BLAKE2b-256 | 8fb055515901826a8be231d400035b242d494b3e356dec4751806546f186fd6a |
Hashes for rocksdict-0.3.1-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad348e873076e74b5d66daff01c95d62307c41675be9d3b346228e860c9541a4 |
|
MD5 | 6f3b40437e93f908a9f8bf261407acfc |
|
BLAKE2b-256 | 0f26c8e8a5e61a817fbe41e449c218617854bae639f726590e2fc58f354912d2 |
Hashes for rocksdict-0.3.1-cp310-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be5f9db0064193d364a2f9b2d0f69d1283c12f3a6a2be735b3524b330cc91602 |
|
MD5 | c60db8637d90e02288285e0329f93c31 |
|
BLAKE2b-256 | 055b96d65b815fe7f65fc6318f0bec033e1d94e761a1478da04aec802a39b1f1 |
Hashes for rocksdict-0.3.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7002079bc28e8da1d12b903849b6202136cc4ff796988cf4b33c92f11419a94a |
|
MD5 | 4b0820624b84cc26977768bbd84b4dab |
|
BLAKE2b-256 | f9ce3c4719bf759ee4ffe0fbfaccccbf1fe55260cc690a769ca9f8cbc3cc4dbd |
Hashes for rocksdict-0.3.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46064df6a5b18069e9601c4381953c3c9cf59294edb0704fd707c15f660965f9 |
|
MD5 | 62b9d7e627de73a8b953f5fa3d40be8e |
|
BLAKE2b-256 | 1a0f4274410661474a453bb3e925f0d3459796a246397cf927431b6d57c866a4 |
Hashes for rocksdict-0.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8f75e5d20e8ade42fe4b6cfde31423ca2ffef5aa58b8c76f23ad59f45b59c00 |
|
MD5 | 82b6402768e4c03e30c9070ee05e0ee2 |
|
BLAKE2b-256 | 311cdf52838d1026a87b68ce9812ce22c94d9423030d69fa0d6d1f70d9cf6ad6 |
Hashes for rocksdict-0.3.1-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b43100ceadcf877aacbbf4a4857d325052cf6651286d6b33f8ff8b0259bf9fa2 |
|
MD5 | 78ec3f11e155ad1c636ed0e0e868a826 |
|
BLAKE2b-256 | 9852fa272446b69d0c04671be4d2169b6011a679840a68ff238015da5520ad68 |
Hashes for rocksdict-0.3.1-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b06179e6dd1ee7f3b4b3c97adec65fe71215565cb135f5f5122adffcaf93281 |
|
MD5 | 4de38667cbadadcca4ffdc20b41a08f0 |
|
BLAKE2b-256 | 66446251f9d465984e2d22f3d521f5cc315ae329ebff6ce1f0e51b1175271fc9 |
Hashes for rocksdict-0.3.1-cp39-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6327b72b493c1ffb429fd5e59069bbc9be5ae918e77ca4859cc9cf026d7bc09 |
|
MD5 | c182f237f73c9819035ed7ddc31afde6 |
|
BLAKE2b-256 | ec06c3fa351f1370e39ef77add6bddb2b480bd435ff44f179a376cb49a6affb7 |
Hashes for rocksdict-0.3.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26e2ebc5b5111d3c587f33198c1147dfcb53dc33d8f9f17df2ef2cee2d762af0 |
|
MD5 | 046a42dad046f9bcd114f31b093ab931 |
|
BLAKE2b-256 | 2280df56aa3054d785cc6460f09edf92c3b20d2cda5affc4657739d97083d588 |
Hashes for rocksdict-0.3.1-cp39-cp39-manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 436510b8e9203bf71c776d4f10e1d32b10d19d6ca5a569967e944400814359b7 |
|
MD5 | 1b998aa363c60e318b0be86dc285e7a7 |
|
BLAKE2b-256 | cfb47b82b9673d91b5605b01918782e26b962544498a4a163e25799d12d2f308 |
Hashes for rocksdict-0.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c70bee49c2a7e04506ad602573177c203ede8c0438e15dade9660ce8bb25450 |
|
MD5 | 49e782921053405bcd3f1109a20107aa |
|
BLAKE2b-256 | 0c8ae782d78cd12b637e01649180a82beb4a06995591d1c795ffcca511ad2ae8 |
Hashes for rocksdict-0.3.1-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 680389b97453a053efe4130c5729f5edbf173409f69e649e2be234e793834928 |
|
MD5 | b9eaf87afaa9044e8ca508b8e402d516 |
|
BLAKE2b-256 | 4fbd628b1d7626dcdab5d8a999af8d783ed7ae37d890b312bcbee014b1d865d6 |
Hashes for rocksdict-0.3.1-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e0cfaebdd55bc843d150bd4139d15313bc39a64c8c9022f3c08a303272b8725 |
|
MD5 | a14a0e1f9c475dd2c6454b182616ba98 |
|
BLAKE2b-256 | 32a1026301cfbdfa9b5aba9d6f7016b13a5225d8a290ed1a96a9a55d7e0dc41a |
Hashes for rocksdict-0.3.1-cp38-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7f252b4f531bf6134d589f8698f2ffab9147779805e5508c0b1c456d1b05fc1 |
|
MD5 | 9e914bacfdfad4af1db6569f9d077eab |
|
BLAKE2b-256 | e68756bdf96577acef3ae85e3fafb300277278ba6ac6e7b7cb599778e02ccad9 |
Hashes for rocksdict-0.3.1-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f5e149944c967b647e01f45da7befb87d757b0e4b4f9835f82cf512a5f1b1f3 |
|
MD5 | 5d3c51009353a11db8affea049271b8f |
|
BLAKE2b-256 | 0fa26f5830a5d7f951d783bf3de2e10caa26cbe7c3462522df92d6f0f422436d |
Hashes for rocksdict-0.3.1-cp38-cp38-manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9f83372cd586f3fd4c5662fb2e70854c1b14b6fb8fe36998267bc68c21b0936 |
|
MD5 | ee84281ee681105206b96d80c980a682 |
|
BLAKE2b-256 | ec58e7f5f98448d7e5889063ef74769992a4de080417827f3f9415399f184381 |
Hashes for rocksdict-0.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6602aab09e404102b3076ffbf093fc249270671107118a6455435e23011207a2 |
|
MD5 | f6be648def5f9a5f72c9868e1ac81073 |
|
BLAKE2b-256 | b1d8dd0de6a54a56ae00251891e758e4e5f21ed94a9e8d31a6952c38c3ee71ee |
Hashes for rocksdict-0.3.1-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b4976152431fb1e41683da1d32557f6545b39a20699fc4234bb3c5b60e3766b |
|
MD5 | 3b231dd3270ca34dfccecc0ea42bbc49 |
|
BLAKE2b-256 | bc7f294aa0df84a5cd79eee922cb8bd7d4e6d9229fe7594f3ce8f6abb1bd4715 |
Hashes for rocksdict-0.3.1-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7da1172bbc5b86b09d5cdef6ea06ef4f15dd168d1bf2e76cafa5895535fb2da9 |
|
MD5 | 1b693d71176116ae46418841a1f7e00a |
|
BLAKE2b-256 | c48dd7a2b0fccd4d64b8a2eb74d5895d94a8c7ee2ecc6e69cf2161d3052c0db3 |
Hashes for rocksdict-0.3.1-cp37-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ccd25f320ab8fffec6f18f46ef6eb4619d838f05b0b0a8c0e7f480a025a0049 |
|
MD5 | c01a48d74a42b9cca83b8f3833d83731 |
|
BLAKE2b-256 | 9b466d5fb649b90c1c65644fafa9995c17a39cd03be47d613862046ee236e58d |
Hashes for rocksdict-0.3.1-cp37-cp37m-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 966747bb5e2fdf4fdf8f8eb6925efa032fb7c3a14c9e8c105ec396a0e03fbf2e |
|
MD5 | 8e47c6975211b1b0b281962b3b423bef |
|
BLAKE2b-256 | 3ae70f018f90838fae90d4ddff4f80bad67256b5ebc72a73b5d3e40e39ca2339 |
Hashes for rocksdict-0.3.1-cp37-cp37m-manylinux_2_28_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ab6288c47fb9b469066c6f68d4658cfcfe5d679d18d06b7c0ca384cf50e09a9 |
|
MD5 | 8236bd510fa7a74003cf695396b0c70e |
|
BLAKE2b-256 | 6d446033c11473fe30da89b7509ec23527f7dba5da898604c106ff6fb982bf63 |
Hashes for rocksdict-0.3.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff84d75ae4df9e0d6ec5170ff35718071a0053dc99160ec1458055140716ea43 |
|
MD5 | cd6ac2f9b3d23c1552e051ad42183446 |
|
BLAKE2b-256 | 50de45aec2d9d7942728676ca06b56ae9cff6a51d65e55ab93a9cf5b67d72e55 |
Hashes for rocksdict-0.3.1-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c305cb2d716922453dd18e2a5d8e37b0bd06edeb1d935f6d216ffa5a5c68329 |
|
MD5 | 54114d37bc33c64211629b495ef24e8c |
|
BLAKE2b-256 | c1df3dab6ac83774429bcbece394163e30931ddbdeeded622a727ef106ae0005 |