Skip to content
This repository was archived by the owner on Jan 24, 2023. It is now read-only.
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

@shan4usmani

Description

@shan4usmani

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions