Command for querying Redis Timeseries MRANGE

Viewed 120

I am trying to work out how to write the command in python to query a redis timerseries from python.

When I query redis from the redis-cli I get a response.

I run the command: ts.mrange - + FILTER ASSET=LAPTOP
all works fine.

I run the following command in python:

import redis

r = redis.Redis(host='xxx.xxx.xxx.xxx', port='xxxxx', password='xxxxxxxxx')
r.ts().mrange('-','+','FILTER ASSET=LAPTOP')

I get the error

ResponseError: TSDB: failed parsing labels

Does anyone have an example of this working in python / can see what I am doing wrong?

1 Answers

There's a good example in the redis-py test cases for testMultiRange.

In short it looks like you might like something like the following:

r = redis.Redis()
r.ts().mrange(0, 200, filters=["FILTER_ASSET=laptop"])
Related