Name | reduct-py JSON |
Version |
1.13.0
JSON |
| download |
home_page | None |
Summary | ReductStore Client SDK for Python |
upload_time | 2024-12-04 17:02:51 |
maintainer | None |
docs_url | None |
author | Ciaran Moyne |
requires_python | >=3.8 |
license | MIT License Copyright (c) 2022 Alexey Timin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
sdk
reductstore
api client
database
time series database
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# ReductStore Client SDK for Python
[![PyPI](https://img.shields.io/pypi/v/reduct-py)](https://pypi.org/project/reduct-py/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/reduct-py)](https://pypi.org/project/reduct-py/)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/reductstore/reduct-py/ci.yml?branch=main)](https://github.com/reductstore/reduct-py/actions)
This package provides an asynchronous HTTP client for interacting with [ReductStore](https://www.reduct.store) in Python.
## Features
* Supports the [ReductStore HTTP API v1.13](https://www.reduct.store/docs/http-api)
* Bucket management
* API Token management
* Write, read and query data
* Labeling records
* Batching records for read and write operations
* Subscription
* Replication management
## Install
To install this package, run the following command:
```
pip install reduct-py
```
## Example
Here is an example of how to use this package to create a bucket, write data to it, and read data from it:
```python
from reduct import Client, BucketSettings, QuotaType
async def main():
# 1. Create a ReductStore client
async with Client("http://localhost:8383", api_token="my-token") as client:
# 2. Get or create a bucket with 1Gb quota
bucket = await client.create_bucket(
"my-bucket",
BucketSettings(quota_type=QuotaType.FIFO, quota_size=1_000_000_000),
exist_ok=True,
)
# 3. Write some data with timestamps in the 'entry-1' entry
await bucket.write("sensor-1", b"<Blob data>",
timestamp="2024-01-01T10:00:00Z",
labels={"score": 10})
await bucket.write("sensor-1", b"<Blob data>",
timestamp="2024-01-01T10:00:01Z",
labels={"score": 20})
# 4. Query the data by time range and condition
async for record in bucket.query("sensor-1",
start="2024-01-01T10:00:00Z",
end="2024-01-01T10:00:02Z",
when={"&score": {"$gt": 10}}):
print(f"Record timestamp: {record.timestamp}")
print(f"Record size: {record.size}")
print(await record.read_all())
# 5. Run the main function
if __name__ == "__main__":
import asyncio
asyncio.run(main())
```
For more examples, see the [Guides](https://reduct.store/docs/guides) section in the ReductStore documentation.
Raw data
{
"_id": null,
"home_page": null,
"name": "reduct-py",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Alexey Timin <atimin@gmail.com>",
"keywords": "sdk, reductstore, api client, database, time series database",
"author": "Ciaran Moyne",
"author_email": "Alexey Timin <atimin@gmail.com>, Anthony Cavin <anthony@reduct.store>",
"download_url": null,
"platform": null,
"description": "# ReductStore Client SDK for Python\n\n[![PyPI](https://img.shields.io/pypi/v/reduct-py)](https://pypi.org/project/reduct-py/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/reduct-py)](https://pypi.org/project/reduct-py/)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/reductstore/reduct-py/ci.yml?branch=main)](https://github.com/reductstore/reduct-py/actions)\n\nThis package provides an asynchronous HTTP client for interacting with [ReductStore](https://www.reduct.store) in Python.\n\n## Features\n\n* Supports the [ReductStore HTTP API v1.13](https://www.reduct.store/docs/http-api)\n* Bucket management\n* API Token management\n* Write, read and query data\n* Labeling records\n* Batching records for read and write operations\n* Subscription\n* Replication management\n\n## Install\n\nTo install this package, run the following command:\n\n```\npip install reduct-py\n```\n\n## Example\n\nHere is an example of how to use this package to create a bucket, write data to it, and read data from it:\n\n```python\nfrom reduct import Client, BucketSettings, QuotaType\n\n\nasync def main():\n # 1. Create a ReductStore client\n async with Client(\"http://localhost:8383\", api_token=\"my-token\") as client:\n # 2. Get or create a bucket with 1Gb quota\n bucket = await client.create_bucket(\n \"my-bucket\",\n BucketSettings(quota_type=QuotaType.FIFO, quota_size=1_000_000_000),\n exist_ok=True,\n )\n\n # 3. Write some data with timestamps in the 'entry-1' entry\n await bucket.write(\"sensor-1\", b\"<Blob data>\",\n timestamp=\"2024-01-01T10:00:00Z\",\n labels={\"score\": 10})\n await bucket.write(\"sensor-1\", b\"<Blob data>\",\n timestamp=\"2024-01-01T10:00:01Z\",\n labels={\"score\": 20})\n\n # 4. Query the data by time range and condition\n async for record in bucket.query(\"sensor-1\",\n start=\"2024-01-01T10:00:00Z\",\n end=\"2024-01-01T10:00:02Z\",\n when={\"&score\": {\"$gt\": 10}}):\n print(f\"Record timestamp: {record.timestamp}\")\n print(f\"Record size: {record.size}\")\n print(await record.read_all())\n\n\n# 5. Run the main function\nif __name__ == \"__main__\":\n import asyncio\n\n asyncio.run(main())\n\n```\n\nFor more examples, see the [Guides](https://reduct.store/docs/guides) section in the ReductStore documentation.\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2022 Alexey Timin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "ReductStore Client SDK for Python",
"version": "1.13.0",
"project_urls": {
"Blog": "https://www.reduct.store/blog",
"Changelog": "https://github.com/reductstore/reduct-py/blob/main/CHANGELOG.md",
"Documentation": "https://www.reduct.store/docs",
"ReductStore": "https://www.reduct.store",
"Source": "https://github.com/reductstore/reduct-py",
"Twitter": "https://twitter.com/ReductStore"
},
"split_keywords": [
"sdk",
" reductstore",
" api client",
" database",
" time series database"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f36df1cfd9a399290135819bf87fe53593b48f648cc17908eb1714781eba5031",
"md5": "764c55a21efbfa497758375c43cf9fbb",
"sha256": "b7aa1f75e214aaa7d17b2f0ea96a588027b1802071bd81b669234dc346204c33"
},
"downloads": -1,
"filename": "reduct_py-1.13.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "764c55a21efbfa497758375c43cf9fbb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 19178,
"upload_time": "2024-12-04T17:02:51",
"upload_time_iso_8601": "2024-12-04T17:02:51.831948Z",
"url": "https://files.pythonhosted.org/packages/f3/6d/f1cfd9a399290135819bf87fe53593b48f648cc17908eb1714781eba5031/reduct_py-1.13.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-04 17:02:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "reductstore",
"github_project": "reduct-py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "reduct-py"
}