Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ReductStore Client SDK for Python

License

NotificationsYou must be signed in to change notification settings

reductstore/reduct-py

Repository files navigation

PyPIPyPI - DownloadsGitHub Workflow Status

This package provides an asynchronous HTTP client for interacting withReductStore in Python.

Features

  • 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

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:

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.

Supported ReductStore Versions and Backward Compatibility

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

Stars

Watchers

Forks

Packages

No packages published

Contributors5

Languages


[8]ページ先頭

©2009-2025 Movatter.jp