1

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
  • My python guru colleague solved it for anyone wanting the solution. The filter needs to be submitted as a list: r.ts().mrange('-','+',['ASSET=LAPTOP']) Commented May 20, 2022 at 9:01

1 Answer 1

2

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"])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.