- Notifications
You must be signed in to change notification settings - Fork2
ReductStore Client SDK for Python
License
reductstore/reduct-py
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This package provides an asynchronous HTTP client for interacting withReductStore in Python.
- Supports theReductStore HTTP API v1.15
- Bucket management
- API Token management
- Write, read and query data
- Labeling records
- Batching records for read and write operations
- Subscription
- Replication management
To install this package, run the following command:
pip install reduct-py
Here is an example of how to use this package to create a bucket, write data to it, and read data from it:
fromreductimportClient,BucketSettings,QuotaTypeasyncdefmain():# 1. Create a ReductStore clientasyncwithClient("http://localhost:8383",api_token="my-token")asclient:# 2. Get or create a bucket with 1Gb quotabucket=awaitclient.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' entryawaitbucket.write("sensor-1",b"<Blob data>",timestamp="2024-01-01T10:00:00Z",labels={"score":10})awaitbucket.write("sensor-1",b"<Blob data>",timestamp="2024-01-01T10:00:01Z",labels={"score":20})# 4. Query the data by time range and conditionasyncforrecordinbucket.query("sensor-1",start="2024-01-01T10:00:00Z",stop="2024-01-01T10:00:02Z",when={"&score": {"$gt":10}}):print(f"Record timestamp:{record.timestamp}")print(f"Record size:{record.size}")print(awaitrecord.read_all())# 5. Run the main functionif__name__=="__main__":importasyncioasyncio.run(main())
For more examples, see theGuides section in the ReductStore documentation.
The library is backward compatible with the previous versions. However, some methods have been deprecated and will beremoved in the future releases. Please refer toCHANGELOG.md for more details.The SDK supports the following ReductStore API versions:
- v1.15
- v1.14
- v1.13
It can work with newer and older versions, but it is not guaranteed that all features will work as expected becausethe API may change and some features may be deprecated or the SDK may not support them yet.
About
ReductStore Client SDK for Python
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.