i am starting to explore yugabyte as an alternative to redis.
i like the idea of the timeseries data type, however, it's not possible to use it from python/pyredis...
...at least not regularly. my current workaround:
i am using "execute_command" and parsing the result myself, like in
result=rcl.execute_command('TSADD', 'cpu_usage', 10, 70) or
result=rcl.execute_command('TSADD', 'cpu_usage', 20, 80, 30, 60, 40, 90) or
result=rcl.execute_command('TSRANGEBYTIME', 'cpu_usage', '20', '(40')
is there any better way to use timeseries from python?
@schlemihl :
Agreed that execute_command() and parsing the results yourself is not ideal.
We plan to add more native API support for TS commands to python driver (instead of execute_command).
Currently, that support has been first added to our Java drivers. See:
Support for TSADD, TSGET, EXPIRE_IN, and EXPIRE_AT
https://github.com/YugaByte/jedis/commit/fe44a3e96f66e4b2a9b0f3af0df8e4af92f360ac
Support for TSRem
https://github.com/YugaByte/jedis/commit/f2e0331e26841906cd6677bba024c6d957129524
Support for TSRangeByTimestamp
https://github.com/YugaByte/jedis/commit/27f02ae7e3165510d865479565ede697922852a4
https://github.com/YugaByte/jedis/commit/89d03db6a6ef5d614f6f9c73325063f7ec1da57a
Support for TSRevRangeByTime:
https://github.com/YugaByte/jedis/commit/93af1a019349a5284da1fb7c7e085e2686600c2c
Support for TSLastN:
https://github.com/YugaByte/jedis/commit/4d92b5a588f2b175846f53c8de1c834e2a365293
Will keep you posted on timeline for this work.
Assigning to @amitanandaiyer who has started work on this.
@schlemihl I've added support for the ts-type commands into our cloned repo here: https://github.com/YugaByte/yb-redis-py
Can you please clone the same, and try to install it locally:
python setup.py install
I have some sample usage in the tests here:
https://github.com/YugaByte/yb-redis-py/blob/ffc221b221f77faf919dded8cb4570f33c51ec6c/tests/test_commands.py#L1142
Thanks,
-Amit
thank you, @amitanandaiyer
i haven't had time to test it yet, but i will soon.
however, i had started my own fix myself before and made it available at
https://github.com/schlemihl/py-yedis
i mean, both solutions mainly wrap the yedis api with what is provided by py-redis.
so, they are certainly not that different. the main difference is that i don't patch py-redis, i am just using it by deriving from StrictRedis. my code is not finished yet, not released, it needs tests etc., but it is to the most part working.
i don't want play the fault-finder here, i simply had started it already and didn't want to hide it.
https://github.com/schlemihl/py-yedis is great!! Thanks for sharing it @schlemihl .
This is awesome @schlemihl!! Very useful - thanks for sharing!
Most helpful comment
thank you, @amitanandaiyer
i haven't had time to test it yet, but i will soon.
however, i had started my own fix myself before and made it available at
https://github.com/schlemihl/py-yedis
i mean, both solutions mainly wrap the yedis api with what is provided by py-redis.
so, they are certainly not that different. the main difference is that i don't patch py-redis, i am just using it by deriving from StrictRedis. my code is not finished yet, not released, it needs tests etc., but it is to the most part working.
i don't want play the fault-finder here, i simply had started it already and didn't want to hide it.