Skip to content
This repository was archived by the owner on Jan 24, 2023. It is now read-only.

how to store a dictionary? and retrieve using range command #112

Open
shan4usmani opened this issue Oct 12, 2021 · 1 comment
Open

how to store a dictionary? and retrieve using range command #112

shan4usmani opened this issue Oct 12, 2021 · 1 comment
Assignees

Comments

@shan4usmani
Copy link

Hi,

I am using Redis for the first time so I don't have a lot of understanding of how this works in python. I have a dictionary with multiple keys along with a time key. I need to save the data in Redis and then retrieve multiple data points using the range function.

data = {'timestamp': 124567889, 'datetime' :9/27/2018 9:04, 'sensor1': 34, 'sensor2': 56, 'sensor3': 90,'sensor4' : 12}

Issue 1:

how can I save this using the Redis time series module?

currently i am creating seperate time series for every sensor :

rts.create(sensor1, labels = {'time':'series'},duplicate_policy='last')
rts.create(sensor2, labels = {'time':'series'},duplicate_policy='last')

and then adding individual values to each time series :
rts.add(sensor1,unixtime,34)
rts.add(sensor2,unixtime,56)

I will have more than 100 different values in the next stage and my current method takes some time to save the data. so is there an easier way where I can save all values together without having to create and save each value individually?

Issue 2:

Also, I am trying to retrieve the data using the range function in the following manner:

rts.range('datetime',start_time,end_time)

but when the date is returned it just says '9.0' instead of complete date '9/272018 9:04'.

any help would be much appreciated.

Thank You.

@OfirMos
Copy link
Contributor

OfirMos commented Oct 14, 2021

Hi,
Can you please send us a script which reproduce the problem?
It's not clear what are the exact parameters you used in the unixtime and the start_time and end_time.

Thanks in advance!

@OfirMos OfirMos self-assigned this Oct 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants