- Notifications
You must be signed in to change notification settings - Fork2
ReductStore Client SDK for Python
License
NotificationsYou must be signed in to change notification settings
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.14
- 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.
About
ReductStore Client SDK for Python
Topics
Resources
License
Code of conduct
Stars
Watchers
Forks
Packages0
No packages published