Skip to content

aftershootco/rocksdb-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7bce0f6 · Mar 28, 2024

History

43 Commits
Sep 16, 2020
Dec 20, 2021
Mar 28, 2024
Feb 6, 2022
Mar 28, 2024
Mar 28, 2024
Sep 17, 2020
Feb 6, 2022
Mar 28, 2024
Mar 28, 2024
Dec 17, 2021
Dec 20, 2021
Sep 14, 2020
Feb 6, 2022
Feb 6, 2022
Mar 28, 2024
Mar 28, 2024
Mar 28, 2024

Repository files navigation

Python bindings for rocksdb

Rocksdb3 is a python bindings for rocksdb based on rust wrapper rust-rocksdb and PyO3.

This is a very early proof-of-concept version. Please do not use it in production.

Actions Status Latest version Support python versions License

Why new wrapper

There is already have python-rocksdb, so why create a new wrapper for rocksdb?

  • It's fun
  • I'm learning Rust, this is my exprience
  • PyO3 is fun, too
  • Python-rocksdb is not actively maintained
  • Python-rocksdb is not released with statically-linked multiple-operating-system-supported wheel binaries
  • Debugging out-of-bounds pointers is boring

Status

  • precompiled wheel binaries for Linux, Windows, macOS, on python 3.5, 3.6, 3.7, 3.8, 3.9, 3.10
  • basic open/put/get/delete/close
  • open as secondary instance
  • destroy/repair
  • iterator
    • iterator with specific prefix
  • write batch
  • options
    • open options
    • read options
    • write options

Install

pip install rocksdb3

Examples

import rocksdb3

path = './db_path'
db = rocksdb3.open_default(path)
assert db.get(b'my key') is None
db.put(b'my key', b'my value')
assert db.get(b'my key') == b'my value'
assert list(db.get_iter()) == [(b'my key', b'my value')]
db.delete(b'my key')
assert db.get(b'my key') is None
del db  # auto close db
rocksdb3.destroy(path)

build

pip install maturin
maturin build