Name | rocksdb-py JSON |
Version |
0.0.6
JSON |
| download |
home_page | None |
Summary | Python bindings for RocksDB |
upload_time | 2025-07-27 09:09:54 |
maintainer | None |
docs_url | None |
author | None |
requires_python | None |
license | Apache-2.0 |
keywords |
rocksdb
rocksdb-py
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
## rocksdb-py
Python bindings for RocksDB written in Rust.
### Features
* Get, set, delete, multi get
* Destroy
* Batch write
* Database iterator
* Read options
### Install
To install a wheel from PyPI,
```bash
pip install --upgrade rocksdb-py
```
or if you want to build a wheel, see [build](https://github.com/trK54Ylmz/rocksdb-py#Build).
### Usage
#### Open database
Open a database with default options.
```python
import rocksdbpy
db = rocksdbpy.open_default('/tmp/rocksdb')
```
Open a database with the specified options.
```python
opts = Option()
opts.create_if_missing(True)
db = rocksdbpy.open('/tmp/rocksdb', opts)
```
Open a database with TTL compaction filter.
```python
opts = Option()
opts.create_if_missing(True)
db = rocksdbpy.open_with_ttl('/tmp/rocksdb', 5, opts)
```
Destroy the database and it's files.
```python
rocksdbpy.destroy('/tmp/rocksdb')
```
Close active database and release lock.
```python
db.close()
```
#### Simple read, set and delete
Set records by key and value.
```python
db.set(b'key', b'value')
```
Get a value associated with a key.
```python
value = db.get(b'key')
```
Remove existing records by key.
```python
db.delete(b'key')
```
#### Batch write, database iterator and flush
Set database entries for list of key and values as a batch.
```python
from rocksdbpy import WriteBatch
batch = WriteBatch()
batch.add(b'first', b'1')
batch.add(b'second', b'2')
db.write(batch)
```
Extra operations for the batch.
```python
batch.delete(b'first')
batch.clear()
size = batch.len()
```
Return a heap-allocated iterator over the contents of the database.
```python
iterator = db.iterator()
iterator = db.iterator(mode='end')
iterator = db.iterator(mode='from', key=b'test')
iterator = db.iterator(mode='from', key=b'test', direction=-1)
for key, value in iterator:
print(key, value)
```
Flush database memtables to SST files on the disk using default options.
```python
db.flush()
```
#### Read options
Set database read options.
```python
opts = Option()
opts.create_if_missing(True)
opts.set_max_open_files(10)
opts.set_use_fsync(True)
opts.set_bytes_per_sync(1024 * 1024)
# and more
```
### Build
You can build PIP package by using `maturin`. The example below is created for MacOS,
```bash
$ git clone https://github.com/trk54ylmz/rocksdb-py.git
$ cd rocksdb-py
$ maturin build
$ pip3 install ./target/wheels/rocksdb_py-0.0.1-cp39-cp39-macosx_11_0_arm64.whl
```
Raw data
{
"_id": null,
"home_page": null,
"name": "rocksdb-py",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "rocksdb, rocksdb-py",
"author": null,
"author_email": "Tarik Yilmaz <tarikyilmaz.54@gmail.com>",
"download_url": null,
"platform": null,
"description": "## rocksdb-py\n\nPython bindings for RocksDB written in Rust.\n\n### Features\n\n* Get, set, delete, multi get\n* Destroy\n* Batch write\n* Database iterator\n* Read options\n\n### Install\n\nTo install a wheel from PyPI,\n\n```bash\npip install --upgrade rocksdb-py\n```\n\nor if you want to build a wheel, see [build](https://github.com/trK54Ylmz/rocksdb-py#Build).\n\n### Usage\n\n#### Open database\n\nOpen a database with default options.\n\n```python\nimport rocksdbpy\n\ndb = rocksdbpy.open_default('/tmp/rocksdb')\n```\n\nOpen a database with the specified options.\n\n```python\nopts = Option()\nopts.create_if_missing(True)\n\ndb = rocksdbpy.open('/tmp/rocksdb', opts)\n```\n\nOpen a database with TTL compaction filter.\n\n```python\nopts = Option()\nopts.create_if_missing(True)\n\ndb = rocksdbpy.open_with_ttl('/tmp/rocksdb', 5, opts)\n```\n\nDestroy the database and it's files.\n\n```python\nrocksdbpy.destroy('/tmp/rocksdb')\n```\n\nClose active database and release lock.\n\n```python\ndb.close()\n```\n\n#### Simple read, set and delete\n\nSet records by key and value.\n\n```python\ndb.set(b'key', b'value')\n```\n\nGet a value associated with a key.\n\n```python\nvalue = db.get(b'key')\n```\n\nRemove existing records by key.\n\n```python\ndb.delete(b'key')\n```\n\n#### Batch write, database iterator and flush\n\nSet database entries for list of key and values as a batch.\n\n```python\nfrom rocksdbpy import WriteBatch\n\nbatch = WriteBatch()\nbatch.add(b'first', b'1')\nbatch.add(b'second', b'2')\n\ndb.write(batch)\n```\n\nExtra operations for the batch.\n\n```python\nbatch.delete(b'first')\n\nbatch.clear()\n\nsize = batch.len()\n```\n\nReturn a heap-allocated iterator over the contents of the database.\n\n```python\niterator = db.iterator()\n\niterator = db.iterator(mode='end')\n\niterator = db.iterator(mode='from', key=b'test')\n\niterator = db.iterator(mode='from', key=b'test', direction=-1)\n\nfor key, value in iterator:\n print(key, value)\n```\n\nFlush database memtables to SST files on the disk using default options.\n\n```python\ndb.flush()\n```\n\n#### Read options\n\nSet database read options.\n\n```python\nopts = Option()\n\nopts.create_if_missing(True)\n\nopts.set_max_open_files(10)\n\nopts.set_use_fsync(True)\n\nopts.set_bytes_per_sync(1024 * 1024)\n\n# and more\n```\n\n### Build\n\nYou can build PIP package by using `maturin`. The example below is created for MacOS,\n\n```bash\n$ git clone https://github.com/trk54ylmz/rocksdb-py.git\n$ cd rocksdb-py\n$ maturin build\n$ pip3 install ./target/wheels/rocksdb_py-0.0.1-cp39-cp39-macosx_11_0_arm64.whl\n```\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Python bindings for RocksDB",
"version": "0.0.6",
"project_urls": null,
"split_keywords": [
"rocksdb",
" rocksdb-py"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c33e3ca475a348a393036cdf1df358b5bd93a23a2867ba9bf99fd047c00f7bf6",
"md5": "720196729b65f1a326ced368160738f9",
"sha256": "1a89df8cbbbc3eaf37edcdb608d0aeae6d1ad83c22939c34e8e05dc0f27abe9e"
},
"downloads": -1,
"filename": "rocksdb_py-0.0.6-cp310-cp310-manylinux_2_31_x86_64.whl",
"has_sig": false,
"md5_digest": "720196729b65f1a326ced368160738f9",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": null,
"size": 4189172,
"upload_time": "2025-07-27T09:09:54",
"upload_time_iso_8601": "2025-07-27T09:09:54.466218Z",
"url": "https://files.pythonhosted.org/packages/c3/3e/3ca475a348a393036cdf1df358b5bd93a23a2867ba9bf99fd047c00f7bf6/rocksdb_py-0.0.6-cp310-cp310-manylinux_2_31_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6e1642811408cc9e06c70fff85ddfad587a15d736b62824c523aaea3ad79e47e",
"md5": "fafec7725ab64141b6df7433b4dec04b",
"sha256": "e8a85120c417ebe36a95306169ba250474547baad60691ae6105e8c981ba56e4"
},
"downloads": -1,
"filename": "rocksdb_py-0.0.6-cp310-cp310-win_amd64.whl",
"has_sig": false,
"md5_digest": "fafec7725ab64141b6df7433b4dec04b",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": null,
"size": 2716279,
"upload_time": "2025-07-27T09:09:58",
"upload_time_iso_8601": "2025-07-27T09:09:58.515264Z",
"url": "https://files.pythonhosted.org/packages/6e/16/42811408cc9e06c70fff85ddfad587a15d736b62824c523aaea3ad79e47e/rocksdb_py-0.0.6-cp310-cp310-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0c426069a9325f4e5fb1206bce7ea1739d533cf077620e1a0300a0fac716531b",
"md5": "682c0540bc374bc79d94f56fd25764c7",
"sha256": "409a608f8caa97fcd6e3932782501cfd22770cbf8632aa320214328dbc10f115"
},
"downloads": -1,
"filename": "rocksdb_py-0.0.6-cp311-cp311-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "682c0540bc374bc79d94f56fd25764c7",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": null,
"size": 3133958,
"upload_time": "2025-07-27T09:10:01",
"upload_time_iso_8601": "2025-07-27T09:10:01.808586Z",
"url": "https://files.pythonhosted.org/packages/0c/42/6069a9325f4e5fb1206bce7ea1739d533cf077620e1a0300a0fac716531b/rocksdb_py-0.0.6-cp311-cp311-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e4909a238363a11af513370161cd28a58259cb9468a480399c297bbdfa277d77",
"md5": "9faccb16d6a7838db4236aa1cb933d6d",
"sha256": "f02254280904c00c50879da06725ea3c68c37af5946df5be3fd33399b54eea6c"
},
"downloads": -1,
"filename": "rocksdb_py-0.0.6-cp311-cp311-manylinux_2_31_x86_64.whl",
"has_sig": false,
"md5_digest": "9faccb16d6a7838db4236aa1cb933d6d",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": null,
"size": 4189175,
"upload_time": "2025-07-27T09:10:04",
"upload_time_iso_8601": "2025-07-27T09:10:04.578549Z",
"url": "https://files.pythonhosted.org/packages/e4/90/9a238363a11af513370161cd28a58259cb9468a480399c297bbdfa277d77/rocksdb_py-0.0.6-cp311-cp311-manylinux_2_31_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7b7277949f448e79ad6765bf1a7fa8939df5492325b7be603b9679e206920ae6",
"md5": "346b8a7d570dc90655df00f830d0e8c1",
"sha256": "a7ba43172c7b916ea23419d0339406a3b2f9ac046d471f51e91972a76e2768b8"
},
"downloads": -1,
"filename": "rocksdb_py-0.0.6-cp311-cp311-win_amd64.whl",
"has_sig": false,
"md5_digest": "346b8a7d570dc90655df00f830d0e8c1",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": null,
"size": 2716288,
"upload_time": "2025-07-27T09:10:06",
"upload_time_iso_8601": "2025-07-27T09:10:06.685980Z",
"url": "https://files.pythonhosted.org/packages/7b/72/77949f448e79ad6765bf1a7fa8939df5492325b7be603b9679e206920ae6/rocksdb_py-0.0.6-cp311-cp311-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0d197524963d3a079fd692c36a1d1637ac2a91935fb43cdbc832d688dd12ec08",
"md5": "e2c156cdb10b1854035395fcbe3e7c47",
"sha256": "7a567c4269237fb8edf05ce2f49dcd8ec02297bc2833e9513402e78c2829d982"
},
"downloads": -1,
"filename": "rocksdb_py-0.0.6-cp312-cp312-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "e2c156cdb10b1854035395fcbe3e7c47",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": null,
"size": 3133530,
"upload_time": "2025-07-27T09:10:08",
"upload_time_iso_8601": "2025-07-27T09:10:08.518717Z",
"url": "https://files.pythonhosted.org/packages/0d/19/7524963d3a079fd692c36a1d1637ac2a91935fb43cdbc832d688dd12ec08/rocksdb_py-0.0.6-cp312-cp312-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6d03f1f920bc5f45c96528774b59910bd0852f8c881f1e4f137721f8736b2add",
"md5": "a72a09d616bc619cd8b04959b010e71e",
"sha256": "d9fff70a485dbb6b8a817f6fc88a8b84a357e286d2b036f69dc3e2ff3bb70f35"
},
"downloads": -1,
"filename": "rocksdb_py-0.0.6-cp312-cp312-manylinux_2_31_x86_64.whl",
"has_sig": false,
"md5_digest": "a72a09d616bc619cd8b04959b010e71e",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": null,
"size": 4189714,
"upload_time": "2025-07-27T09:10:10",
"upload_time_iso_8601": "2025-07-27T09:10:10.453916Z",
"url": "https://files.pythonhosted.org/packages/6d/03/f1f920bc5f45c96528774b59910bd0852f8c881f1e4f137721f8736b2add/rocksdb_py-0.0.6-cp312-cp312-manylinux_2_31_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "57623731d70ec284ad4756ba9acb6a30cb2aa62c59eb38e7cf90cf812ca62d22",
"md5": "7cfa2bbee28b93e4add0fde30f083ee0",
"sha256": "da309f3e2b7836303b46a99dff3a0dddb2176e089dd54e114964153c5212f258"
},
"downloads": -1,
"filename": "rocksdb_py-0.0.6-cp312-cp312-win_amd64.whl",
"has_sig": false,
"md5_digest": "7cfa2bbee28b93e4add0fde30f083ee0",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": null,
"size": 2716326,
"upload_time": "2025-07-27T09:10:13",
"upload_time_iso_8601": "2025-07-27T09:10:13.629341Z",
"url": "https://files.pythonhosted.org/packages/57/62/3731d70ec284ad4756ba9acb6a30cb2aa62c59eb38e7cf90cf812ca62d22/rocksdb_py-0.0.6-cp312-cp312-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9e429f96d30bafc7842370d065e98a1e431b447d5d8525b5eb17747c3c643a6c",
"md5": "7fdaa06adc561ccd6a6260a7a565fcdc",
"sha256": "908c1b9404d72e3e9506c2e9f6a5e7b9bc57e8b1c939c12c544edfc154c0dc4c"
},
"downloads": -1,
"filename": "rocksdb_py-0.0.6-cp313-cp313-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "7fdaa06adc561ccd6a6260a7a565fcdc",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": null,
"size": 3133531,
"upload_time": "2025-07-27T09:10:15",
"upload_time_iso_8601": "2025-07-27T09:10:15.372784Z",
"url": "https://files.pythonhosted.org/packages/9e/42/9f96d30bafc7842370d065e98a1e431b447d5d8525b5eb17747c3c643a6c/rocksdb_py-0.0.6-cp313-cp313-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8833a2058de3c44e990ad034396c45428ff6649ae79371241ec85165b5abb585",
"md5": "5454489c464e121318cb3b35b9912dd8",
"sha256": "1a9f40e903b038b7985fef60751057aeb2f5b368505a9305eb977e966ee6da68"
},
"downloads": -1,
"filename": "rocksdb_py-0.0.6-cp313-cp313-manylinux_2_31_x86_64.whl",
"has_sig": false,
"md5_digest": "5454489c464e121318cb3b35b9912dd8",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": null,
"size": 4189714,
"upload_time": "2025-07-27T09:10:17",
"upload_time_iso_8601": "2025-07-27T09:10:17.708625Z",
"url": "https://files.pythonhosted.org/packages/88/33/a2058de3c44e990ad034396c45428ff6649ae79371241ec85165b5abb585/rocksdb_py-0.0.6-cp313-cp313-manylinux_2_31_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c247f783ed25a45cf4f2ac3583eebd9aaf0506583f7b773c18a0da02df796124",
"md5": "9737f1111f01ef858eff45d3628202cc",
"sha256": "6907fde301942e7328ba30c6e16e1fbdfcc7b3bb215edaa9fdfd93e5cb916657"
},
"downloads": -1,
"filename": "rocksdb_py-0.0.6-cp313-cp313-win_amd64.whl",
"has_sig": false,
"md5_digest": "9737f1111f01ef858eff45d3628202cc",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": null,
"size": 2716326,
"upload_time": "2025-07-27T09:10:19",
"upload_time_iso_8601": "2025-07-27T09:10:19.431259Z",
"url": "https://files.pythonhosted.org/packages/c2/47/f783ed25a45cf4f2ac3583eebd9aaf0506583f7b773c18a0da02df796124/rocksdb_py-0.0.6-cp313-cp313-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "97b1877c659722a983d83e942c0dcfef5031bf107adee774199917ce6da36bd2",
"md5": "9d4992995645cd8b18473ce4ee9563d9",
"sha256": "7c191d4a378f50f8187d72821f75bdb01cd9f316b1b584d256d2bb35a2353d9f"
},
"downloads": -1,
"filename": "rocksdb_py-0.0.6-cp39-cp39-manylinux_2_31_x86_64.whl",
"has_sig": false,
"md5_digest": "9d4992995645cd8b18473ce4ee9563d9",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": null,
"size": 4189193,
"upload_time": "2025-07-27T09:10:21",
"upload_time_iso_8601": "2025-07-27T09:10:21.370944Z",
"url": "https://files.pythonhosted.org/packages/97/b1/877c659722a983d83e942c0dcfef5031bf107adee774199917ce6da36bd2/rocksdb_py-0.0.6-cp39-cp39-manylinux_2_31_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "ff783170306df04f4936f2f153ec8b12b43998da8e2531d01e98f42c9684b5fe",
"md5": "5f189063a0e6b083a8f2849d0f48056d",
"sha256": "d860c2f145bdc1f1f6e5b5f078a6d5bd1147eaf33887389c53a6cd59a2094081"
},
"downloads": -1,
"filename": "rocksdb_py-0.0.6-cp39-cp39-win_amd64.whl",
"has_sig": false,
"md5_digest": "5f189063a0e6b083a8f2849d0f48056d",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": null,
"size": 2716578,
"upload_time": "2025-07-27T09:10:23",
"upload_time_iso_8601": "2025-07-27T09:10:23.447601Z",
"url": "https://files.pythonhosted.org/packages/ff/78/3170306df04f4936f2f153ec8b12b43998da8e2531d01e98f42c9684b5fe/rocksdb_py-0.0.6-cp39-cp39-win_amd64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-27 09:09:54",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "rocksdb-py"
}