rocksdb-py


Namerocksdb-py JSON
Version 0.0.5 PyPI version JSON
download
home_page
SummaryPython bindings for RocksDB
upload_time2023-10-10 22:16:02
maintainer
docs_urlNone
author
requires_python
licenseApache-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": "",
    "name": "rocksdb-py",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "rocksdb,rocksdb-py",
    "author": "",
    "author_email": "Tarik Yilmaz <tarikyilmaz.54@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/e1/98/9806f3aa7fc64be2ef1edecc9d9f3e874294b9f06dc7f4e9b6c5723c4b1c/rocksdb_py-0.0.5.tar.gz",
    "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.5",
    "project_urls": null,
    "split_keywords": [
        "rocksdb",
        "rocksdb-py"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4915dc775b1fee8041ad12f6d481ff0a56d6b04e9a5bc6bd4f56eb3cebf47d2a",
                "md5": "ed77052845848c20775fda2f2a3b36a4",
                "sha256": "7015b010bc43a84ae0d76dab402ed770c7bf8f302db7ac1ce511f0f79874f376"
            },
            "downloads": -1,
            "filename": "rocksdb_py-0.0.5-cp310-cp310-macosx_10_14_x86_64.whl",
            "has_sig": false,
            "md5_digest": "ed77052845848c20775fda2f2a3b36a4",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": null,
            "size": 3196528,
            "upload_time": "2023-10-10T22:15:06",
            "upload_time_iso_8601": "2023-10-10T22:15:06.990496Z",
            "url": "https://files.pythonhosted.org/packages/49/15/dc775b1fee8041ad12f6d481ff0a56d6b04e9a5bc6bd4f56eb3cebf47d2a/rocksdb_py-0.0.5-cp310-cp310-macosx_10_14_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e85756189314c592f9bf649a4a35065682a95482218159e499b0a2769fbe2fd5",
                "md5": "24ef0792b53bfb4708bef97134f4e33e",
                "sha256": "55ec77a0c548eeb9a9418081e328a2ea82f82b7679eb36bbfa0eeefc2aa5ef07"
            },
            "downloads": -1,
            "filename": "rocksdb_py-0.0.5-cp310-cp310-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "24ef0792b53bfb4708bef97134f4e33e",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": null,
            "size": 2875144,
            "upload_time": "2023-10-10T22:15:11",
            "upload_time_iso_8601": "2023-10-10T22:15:11.388169Z",
            "url": "https://files.pythonhosted.org/packages/e8/57/56189314c592f9bf649a4a35065682a95482218159e499b0a2769fbe2fd5/rocksdb_py-0.0.5-cp310-cp310-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6883b7ae81b5c58fd5a775cc2e8a671578f31f8a8077afd36ea4d66c36c69150",
                "md5": "951c060de0400b84b51f72f7407a2f4f",
                "sha256": "3d05a80e5bac8e6b1c54f3eac9b4fbf15767557eb963676fc4a6888ac3259743"
            },
            "downloads": -1,
            "filename": "rocksdb_py-0.0.5-cp310-cp310-manylinux_2_31_x86_64.whl",
            "has_sig": false,
            "md5_digest": "951c060de0400b84b51f72f7407a2f4f",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": null,
            "size": 4686029,
            "upload_time": "2023-10-10T22:15:17",
            "upload_time_iso_8601": "2023-10-10T22:15:17.859321Z",
            "url": "https://files.pythonhosted.org/packages/68/83/b7ae81b5c58fd5a775cc2e8a671578f31f8a8077afd36ea4d66c36c69150/rocksdb_py-0.0.5-cp310-cp310-manylinux_2_31_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bfb432187c5fb228baf1f19766f3bb812293e22d657a299560f1d0c1cdd43395",
                "md5": "9b573dc954fd94e05fea0231c6bb9d9d",
                "sha256": "1b843d5302836a148f39065badf75786e1db470a485c2667c2e7d0904614e371"
            },
            "downloads": -1,
            "filename": "rocksdb_py-0.0.5-cp310-none-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "9b573dc954fd94e05fea0231c6bb9d9d",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": null,
            "size": 2359450,
            "upload_time": "2023-10-10T22:15:23",
            "upload_time_iso_8601": "2023-10-10T22:15:23.981342Z",
            "url": "https://files.pythonhosted.org/packages/bf/b4/32187c5fb228baf1f19766f3bb812293e22d657a299560f1d0c1cdd43395/rocksdb_py-0.0.5-cp310-none-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "75d3785783f4ac3e04d7a982f1bae5482cdbb463e56f9215086d77ce001cae4c",
                "md5": "1af72f46a4f69048288f62dd9026c0a9",
                "sha256": "785a40df814540d3cfc6713d4ca88a9e9f40ac1546dfb9baff624eace3c5e520"
            },
            "downloads": -1,
            "filename": "rocksdb_py-0.0.5-cp311-cp311-macosx_10_14_x86_64.whl",
            "has_sig": false,
            "md5_digest": "1af72f46a4f69048288f62dd9026c0a9",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": null,
            "size": 3196753,
            "upload_time": "2023-10-10T22:15:27",
            "upload_time_iso_8601": "2023-10-10T22:15:27.656049Z",
            "url": "https://files.pythonhosted.org/packages/75/d3/785783f4ac3e04d7a982f1bae5482cdbb463e56f9215086d77ce001cae4c/rocksdb_py-0.0.5-cp311-cp311-macosx_10_14_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "909367ac7d013a8182c45c614a53cd23efa46bd91583c856ff33462fa94e6524",
                "md5": "ced0adf10f7a79ee2fd4c4fafed49db8",
                "sha256": "689b64c5ebe81ea908f6924b1683c99553d9c2ea53a55697f903ed1d4d57b92a"
            },
            "downloads": -1,
            "filename": "rocksdb_py-0.0.5-cp311-cp311-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "ced0adf10f7a79ee2fd4c4fafed49db8",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": null,
            "size": 2875369,
            "upload_time": "2023-10-10T22:15:32",
            "upload_time_iso_8601": "2023-10-10T22:15:32.367140Z",
            "url": "https://files.pythonhosted.org/packages/90/93/67ac7d013a8182c45c614a53cd23efa46bd91583c856ff33462fa94e6524/rocksdb_py-0.0.5-cp311-cp311-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "695ee7f8397613ed7f6e3b0b8547ab361173bc3a240aec06591e95450648d2d9",
                "md5": "435cfcdddea91001018d71facfcce06d",
                "sha256": "470e26aff4a89f91bdf874e53faf30f314e2c025a5510223e9bcd2ec9e76e3d8"
            },
            "downloads": -1,
            "filename": "rocksdb_py-0.0.5-cp311-cp311-manylinux_2_31_x86_64.whl",
            "has_sig": false,
            "md5_digest": "435cfcdddea91001018d71facfcce06d",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": null,
            "size": 4686271,
            "upload_time": "2023-10-10T22:15:38",
            "upload_time_iso_8601": "2023-10-10T22:15:38.669780Z",
            "url": "https://files.pythonhosted.org/packages/69/5e/e7f8397613ed7f6e3b0b8547ab361173bc3a240aec06591e95450648d2d9/rocksdb_py-0.0.5-cp311-cp311-manylinux_2_31_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d828dfaa32ea63cf88a083350c9d5e80d9e80817b2374ac8f7c1d0b75f1bb6cb",
                "md5": "227a8d942275becb19d2645c741f6b6e",
                "sha256": "f1e332fc8f3427920edfa9db3346c12c9cb2f88a0561aa9598fb5f0dcd71e430"
            },
            "downloads": -1,
            "filename": "rocksdb_py-0.0.5-cp311-none-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "227a8d942275becb19d2645c741f6b6e",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": null,
            "size": 2359417,
            "upload_time": "2023-10-10T22:15:43",
            "upload_time_iso_8601": "2023-10-10T22:15:43.374405Z",
            "url": "https://files.pythonhosted.org/packages/d8/28/dfaa32ea63cf88a083350c9d5e80d9e80817b2374ac8f7c1d0b75f1bb6cb/rocksdb_py-0.0.5-cp311-none-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4cd720eb8d9eda7e854bf5798c32ab36fdbae2f1df83bfeeff8949da3f447b41",
                "md5": "67fa0f435dc49c547eca8e76a26fb948",
                "sha256": "bea6d965aadb5b1815c132521f2ef3b3acc344d72b60eca8d33871181fef0525"
            },
            "downloads": -1,
            "filename": "rocksdb_py-0.0.5-cp39-cp39-macosx_10_14_x86_64.whl",
            "has_sig": false,
            "md5_digest": "67fa0f435dc49c547eca8e76a26fb948",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": null,
            "size": 3196796,
            "upload_time": "2023-10-10T22:15:47",
            "upload_time_iso_8601": "2023-10-10T22:15:47.740816Z",
            "url": "https://files.pythonhosted.org/packages/4c/d7/20eb8d9eda7e854bf5798c32ab36fdbae2f1df83bfeeff8949da3f447b41/rocksdb_py-0.0.5-cp39-cp39-macosx_10_14_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a1f237f312989d8212ea4afd11e7f91140a38495c6d29d465715b4b506849c07",
                "md5": "c50045694cff4c5605d412d764620a97",
                "sha256": "262c41d68f5f98d5fae5e33c16fd9e53fba506f1cd0b20514d36f144caf0d7b2"
            },
            "downloads": -1,
            "filename": "rocksdb_py-0.0.5-cp39-cp39-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "c50045694cff4c5605d412d764620a97",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": null,
            "size": 2875319,
            "upload_time": "2023-10-10T22:15:51",
            "upload_time_iso_8601": "2023-10-10T22:15:51.457169Z",
            "url": "https://files.pythonhosted.org/packages/a1/f2/37f312989d8212ea4afd11e7f91140a38495c6d29d465715b4b506849c07/rocksdb_py-0.0.5-cp39-cp39-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6938755ac17351c085e71f130cbe94b7428392b1145de66cd9af96fecdfdfd71",
                "md5": "cad66175e62d9279b2ec3e0580cd6aa0",
                "sha256": "6a73fb07efcbcfdb902fcd6ba32edd9f3386621d6b89e2e2921774c7d5fc9c84"
            },
            "downloads": -1,
            "filename": "rocksdb_py-0.0.5-cp39-cp39-manylinux_2_31_x86_64.whl",
            "has_sig": false,
            "md5_digest": "cad66175e62d9279b2ec3e0580cd6aa0",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": null,
            "size": 4685844,
            "upload_time": "2023-10-10T22:15:57",
            "upload_time_iso_8601": "2023-10-10T22:15:57.227765Z",
            "url": "https://files.pythonhosted.org/packages/69/38/755ac17351c085e71f130cbe94b7428392b1145de66cd9af96fecdfdfd71/rocksdb_py-0.0.5-cp39-cp39-manylinux_2_31_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e39096f430957fe59ff6cfc15afa333b160e3844830753e2293ab4b13de1317f",
                "md5": "ae762f2293dfb8a9d02a081ad88a450b",
                "sha256": "f02bcf5869b1d88c294697cae01aac15c44611237e9eb9c775ef33e24514e7c8"
            },
            "downloads": -1,
            "filename": "rocksdb_py-0.0.5-cp39-none-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "ae762f2293dfb8a9d02a081ad88a450b",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": null,
            "size": 2359563,
            "upload_time": "2023-10-10T22:16:01",
            "upload_time_iso_8601": "2023-10-10T22:16:01.562830Z",
            "url": "https://files.pythonhosted.org/packages/e3/90/96f430957fe59ff6cfc15afa333b160e3844830753e2293ab4b13de1317f/rocksdb_py-0.0.5-cp39-none-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e1989806f3aa7fc64be2ef1edecc9d9f3e874294b9f06dc7f4e9b6c5723c4b1c",
                "md5": "36a53c15c259f297cd67ef4dc90a1430",
                "sha256": "9ccc51a6e4350d766381bf996a5231331807988ea18a2062c28c4537dbf47fec"
            },
            "downloads": -1,
            "filename": "rocksdb_py-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "36a53c15c259f297cd67ef4dc90a1430",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 54103,
            "upload_time": "2023-10-10T22:16:02",
            "upload_time_iso_8601": "2023-10-10T22:16:02.994057Z",
            "url": "https://files.pythonhosted.org/packages/e1/98/9806f3aa7fc64be2ef1edecc9d9f3e874294b9f06dc7f4e9b6c5723c4b1c/rocksdb_py-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-10 22:16:02",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "rocksdb-py"
}
        
Elapsed time: 2.03811s