i need help with redistimeseries python client. When i use redisclientobject.range() method of python client, i am unable to provide the optional field [Latest]. is it not supported by python library?.. using "Latest" is critical for me because, when i do aggregation, i need the ongoing bucket data (partial).
the same problem is observed with get, mget functions too.
Background. : i am storing live stock data (ticks) and i use compaction (aggregation) by creating rule. At the same time, i need to plot the live tick data on the chart which means i need the latest ongoing compaction data .
Whereas when i use redis cli and issue ts.range key – + latest , i get the ongoing compaction. But in Python client library i do not know if it is possible. I have checked the def range() method of the Client class and i believe that the optional field ‘Latest’ is not implemented
on the redis cli below are the results
TS.RANGE VWAP:ticks:MCX:CRUDEOIL22SEPFUT 1662717300000 1662791113000 latest
////
-
- (integer) 1662717300000
- 738244
-
- (integer) 1662717600000
- 724450
and without latest,
TS.RANGE VWAP:5min:MCX:CRUDEOIL22SEPFUT 1662717300000 1662791113000
-
- (integer) 1662717300000
- 738244
2
Answers
I have subclassed the client and modified the get method as follows (actually renamed get method to myget instead of overriding)
class myRedisTSClient(Client): def init(self, conn=None, *args, **kwargs): super().init(conn, *args, **kwargs)
Are you using the latest redis-py (4.4.0rc1)?
https://github.com/redis/redis-py/pull/2296
https://github.com/redis/redis-py/releases/tag/v4.4.0rc1
Note that RedisTimeSeries 1.8 is still a release candidate.