【问题标题】:How to use "mrange" function in Python module "redis-py"?如何在 Python 模块“redis-py”中使用“mrange”函数?
【发布时间】:2022-06-16 23:20:50
【问题描述】:

我正在尝试习惯 redis-py Python 模块。我只是不知道如何使用“mrange”函数通过其标签获取一个或多个时间序列。

在 CLI 中它看起来像这样并且它可以工作:

TS.MRANGE - + FILTER area_id=32

但我无法让它在 Python 中工作(我尝试过的许多事情之一):

import redis

r = redis.Redis()

r.ts().mrange("-","+","area_id:32")
r.ts().mrange("-","+",filters="area_id:32")
r.ts().mrange("-","+",filters='{area_id}32')

#And I tried many more...

我收到以下错误:

ResponseError: TSDB: failed parsing labels

【问题讨论】:

    标签: python redis time-series redis-py redistimeseries


    【解决方案1】:

    r.ts().mrange('-','+',['area_id=32'])

    你需要[方括号]

    【讨论】:

      猜你喜欢
      • 2012-05-14
      • 2017-06-17
      • 2013-04-21
      • 2021-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-15
      相关资源
      最近更新 更多