# rocksdb-python [![version](https://img.shields.io/pypi/v/rocksdb-python?style=flat&logo=pypi)](https://pypi.org/project/rocksdb-python) [![downloads](https://img.shields.io/pypi/dm/rocksdb-python?style=flat)](https://pypistats.org/packages/rocksdb-python)
Simple and easy rocksdb client for python.
> NOTE: This client dosen't fully support rocksdb. Only the basic usage of rocksdb is supported.
### Requirements
- python3.8+
- [rocksdb](https://github.com/facebook/rocksdb)
Installation
------------
We need to [install](https://github.com/facebook/rocksdb/blob/master/INSTALL.md) and build rocksdb alongside rocksdb-python.
Build rocksdb
-------------
From source:
***********
```bash
apt-get install build-essential libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
git clone https://github.com/facebook/rocksdb.git
cd rocksdb
mkdir build
cd build
make shared_lib
```
Choose where to install rocksdb after building
*******************************
- You can install rocksdb shared library in `/usr/lib/` (systemwide) using:
```bash
make install-shared INSTALL_PATH=/usr
```
- If you wish to uninstall it use:
```bash
make uninstall INSTALL_PATH=/usr
```
- If you don't like to install it systemwide you can set the following environment variables which will help the compiler to find rocksdb:
```bash
export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}:`pwd`/../include
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:`pwd`
export LIBRARY_PATH=${LIBRARY_PATH}:`pwd`
```
Install rocksdb-python
----------------------
Using pip:
```bash
pip install rocksdb-python
```
From source (development version):
```bash
pip install git+https://github.com/AYMENJD/rocksdb-python
```
Usage
-----
```python
import rocksdb, asyncio
async def main():
db = rocksdb.RocksDB(db_path="myrocksdb/", options=rocksdb.Options(create_if_missing=True))
key = "123-456-789"
response = await db.put(rocksdb.WriteOptions(), key, "Hello world. Bye!")
if response.status.ok: # You always need to check if the request success.
get_value = await db.get(rocksdb.ReadOptions(), key)
print(get_value.value) # Hello world. Bye!
await db.delete(rocksdb.WriteOptions(), key)
else:
print(get_value.status.to_dict())
await db.close()
asyncio.run(main())
```
Check [Documentation](https://github.com/AYMENJD/rocksdb-python/wiki) for more.
Contributing
------------
Pull requests are always welcome!!
License
-------
MIT [License](https://github.com/AYMENJD/rocksdb-python/blob/main/LICENSE)
Raw data
{
"_id": null,
"home_page": "https://github.com/AYMENJD/rocksdb-python",
"name": "Rocksdb-python",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "rocksdb,database,async,python,pybind11",
"author": "AYMEN Mohammed",
"author_email": "let.me.code.safe@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/32/4d/4d1163d3adf164fa2ec9ec9ae6c5dc8b55a56e92f8486be612df1606430c/Rocksdb-python-0.1.2.tar.gz",
"platform": null,
"description": "# rocksdb-python [![version](https://img.shields.io/pypi/v/rocksdb-python?style=flat&logo=pypi)](https://pypi.org/project/rocksdb-python) [![downloads](https://img.shields.io/pypi/dm/rocksdb-python?style=flat)](https://pypistats.org/packages/rocksdb-python)\n\nSimple and easy rocksdb client for python.\n> NOTE: This client dosen't fully support rocksdb. Only the basic usage of rocksdb is supported.\n\n### Requirements\n\n- python3.8+\n- [rocksdb](https://github.com/facebook/rocksdb)\n\nInstallation\n------------\n\nWe need to [install](https://github.com/facebook/rocksdb/blob/master/INSTALL.md) and build rocksdb alongside rocksdb-python.\n\nBuild rocksdb\n-------------\n\nFrom source:\n***********\n```bash\napt-get install build-essential libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev\ngit clone https://github.com/facebook/rocksdb.git\ncd rocksdb\nmkdir build\ncd build\nmake shared_lib\n```\nChoose where to install rocksdb after building\n*******************************\n- You can install rocksdb shared library in `/usr/lib/` (systemwide) using:\n ```bash\n make install-shared INSTALL_PATH=/usr\n ```\n - If you wish to uninstall it use:\n ```bash\n make uninstall INSTALL_PATH=/usr\n ```\n\n- If you don't like to install it systemwide you can set the following environment variables which will help the compiler to find rocksdb:\n ```bash\n export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}:`pwd`/../include\n export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:`pwd`\n export LIBRARY_PATH=${LIBRARY_PATH}:`pwd`\n ```\n\nInstall rocksdb-python\n----------------------\nUsing pip:\n```bash\npip install rocksdb-python\n```\n\nFrom source (development version):\n```bash\npip install git+https://github.com/AYMENJD/rocksdb-python\n```\n\nUsage\n-----\n```python\nimport rocksdb, asyncio\n\nasync def main():\n db = rocksdb.RocksDB(db_path=\"myrocksdb/\", options=rocksdb.Options(create_if_missing=True))\n\n key = \"123-456-789\"\n response = await db.put(rocksdb.WriteOptions(), key, \"Hello world. Bye!\")\n\n if response.status.ok: # You always need to check if the request success.\n get_value = await db.get(rocksdb.ReadOptions(), key)\n\n print(get_value.value) # Hello world. Bye!\n\n await db.delete(rocksdb.WriteOptions(), key)\n else:\n print(get_value.status.to_dict())\n\n\n await db.close()\n\nasyncio.run(main())\n```\nCheck [Documentation](https://github.com/AYMENJD/rocksdb-python/wiki) for more.\n\nContributing\n------------\nPull requests are always welcome!!\n\nLicense\n-------\n\nMIT [License](https://github.com/AYMENJD/rocksdb-python/blob/main/LICENSE)\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Simple and easy rocksdb client for python",
"version": "0.1.2",
"split_keywords": [
"rocksdb",
"database",
"async",
"python",
"pybind11"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "324d4d1163d3adf164fa2ec9ec9ae6c5dc8b55a56e92f8486be612df1606430c",
"md5": "a9df790ed7c65f5f0c6278b6ed6cd915",
"sha256": "5c644ec17cf19eed9627d478cb2e0c0ba35bd72a3425a2fb0e7e6f44397d7ed9"
},
"downloads": -1,
"filename": "Rocksdb-python-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "a9df790ed7c65f5f0c6278b6ed6cd915",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 759043,
"upload_time": "2023-01-07T16:07:36",
"upload_time_iso_8601": "2023-01-07T16:07:36.819094Z",
"url": "https://files.pythonhosted.org/packages/32/4d/4d1163d3adf164fa2ec9ec9ae6c5dc8b55a56e92f8486be612df1606430c/Rocksdb-python-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-07 16:07:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "AYMENJD",
"github_project": "rocksdb-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "rocksdb-python"
}