Skip to main content

license PyPI version CircleCI GitHub issues Codecov Language grade: Python Known Vulnerabilities

redistimeseries-py

Forum Discord

Deprecation notice

As of redis-py 4.0.0 this library is deprecated. It's features have been merged into redis-py. Please either install it from pypy or the repo.


redistimeseries-py is a package that gives developers easy access to RedisTimeSeries module. The package extends redis-py's interface with RedisTimeSeries's API.

Installation

$ pip install redistimeseries

Development

  1. Create a virtualenv to manage your python dependencies, and ensure it's active. virtualenv -v venv
  2. Install pypoetry to manage your dependencies. pip install poetry
  3. Install dependencies. poetry install

tox runs all tests as its default target. Running tox by itself will run unit tests. Ensure you have a running redis, with the module loaded.

API

The complete documentation of RedisTimeSeries's commands can be found at RedisTimeSeries's website.

Usage example

# Simple example
from redistimeseries.client import Client
rts = Client()
rts.create('test', labels={'Time':'Series'})
rts.add('test', 1, 1.12)
rts.add('test', 2, 1.12)
rts.get('test')
rts.incrby('test',1)
rts.range('test', 0, -1)
rts.range('test', 0, -1, aggregation_type='avg', bucket_size_msec=10)
rts.range('test', 0, -1, aggregation_type='sum', bucket_size_msec=10)
rts.info('test').__dict__

# Example with rules
rts.create('source', retention_msecs=40)
rts.create('sumRule')
rts.create('avgRule')
rts.createrule('source', 'sumRule', 'sum', 20)
rts.createrule('source', 'avgRule', 'avg', 15)
rts.add('source', '*', 1)
rts.add('source', '*', 2)
rts.add('source', '*', 3)
rts.get('sumRule')
rts.get('avgRule')
rts.info('sumRule').__dict__

Further notes on back-filling time series

Since RedisTimeSeries 1.4 we've added the ability to back-fill time series, with different duplicate policies.

The default behavior is to block updates to the same timestamp, and you can control it via the duplicate_policy argument. You can check in detail the duplicate policy documentation.

Bellow you can find an example of the LAST duplicate policy, in which we override duplicate timestamps with the latest value:

from redistimeseries.client import Client
rts = Client()
rts.create('last-upsert', labels={'Time':'Series'}, duplicate_policy='last')
rts.add('last-upsert', 1, 10.0)
rts.add('last-upsert', 1, 5.0)
# should output [(1, 5.0)]
print(rts.range('last-upsert', 0, -1))

License

BSD 3-Clause

Metadata

Release files for redistimeseries 1.4.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redistimeseries 1.4.5
File Size Uploaded
redistimeseries-1.4.5.tar.gz 10.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for redistimeseries 1.4.5
File Interpreter ABI Platform
redistimeseries-1.4.5-py3-none-any.whl Python 3 none any Details

Total release size: 19.9 kB

Release files / redistimeseries-1.4.5.tar.gz

Download URL redistimeseries-1.4.5.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
aad2030472f4ace0e3a1e70ab1c9ab9b818cd674277ee2014d0aba1a35a3b06c
BLAKE2b-256 checksum
How to use checksums
62d12ba15e20c7f3f843648cc63375db954d060f97af5974ec1cb847fbec37d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.7.12 Linux/5.11.0-1028-azure

Release files / redistimeseries-1.4.5-py3-none-any.whl

Download URL redistimeseries-1.4.5-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3fa4c66716bfb5134ec1bbe67907d406072493b6f5d1b28c7bb5e91838749ee0
BLAKE2b-256 checksum
How to use checksums
2418be22d070adcc5b06c51a38cce6120ca67dd97fffd2cb57eb4ab683b97162
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.7.12 Linux/5.11.0-1028-azure

Release history Release notifications | RSS feed

This release

1.4.5 This release

2 release files

1.4.4

2 release files

1.4.3

2 release files

0.8.0

1 release file

0.7.0

1 release file

0.6.2

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page