Questions tagged [py-redis]

Tags for questions about redis-py. The python implementation of the Redis database protocol.

Tags for questions about redis-py. The python implementation of the Redis database protocol.

Read more about redis-py here

21 questions
28
votes
5 answers

How to set/get Pandas dataframes into Redis using pyarrow

Using dd = {'ID': ['H576','H577','H578','H600', 'H700'], 'CD': ['AAAAAAA', 'BBBBB', 'CCCCCC','DDDDDD', 'EEEEEEE']} df = pd.DataFrame(dd) Pre Pandas 0.25, this below worked. set: redisConn.set("key", df.to_msgpack(compress='zlib')) get: …
Merlin
  • 24,552
  • 41
  • 131
  • 206
5
votes
3 answers

redis-py not closing threads on exit

I am using redis-py 2.10.6 and redis 4.0.11. My application uses redis for both the db and the pubsub. When I shut down I often get either hanging or a crash. The latter usually complains about a bad file descriptor or an I/O error on a file (I…
Dirich
  • 412
  • 3
  • 13
4
votes
3 answers

Is Redis TimeSeries the right tool to capture candle sticks in stock prices

I am currently trying to do a simple implementation for stock price candle sticks. Let's say we have a stock called XYZ. This stock receives a stream of prices (in no particular frequency), which (for example) looks like: XYZ: [10.2, 10.7, 12, 11…
alt-f4
  • 2,112
  • 17
  • 49
2
votes
0 answers

Implementing cache using Redis with RDBMS tables

My problem: I need to implement a cache that stores RDBMS (I'm using Microsoft SQL Server) tables to the In-Memory of the caching server. What RDBMS tables provides: It allows me to query tables with any columns and returns the filtered records…
Vikash
  • 857
  • 1
  • 13
  • 32
1
vote
0 answers

Efficiently setting and deleting array items with Redis JSON

I'm using Redis OM for Python and my models look like below: from typing import List from pydantic import BaseModel from redis_om import EmbeddedJsonModel, Field, JsonModel, Migrator class FeedItem(EmbeddedJsonModel): id: str =…
knl
  • 969
  • 11
  • 35
1
vote
1 answer

redis retrieve data at suscribe when key expire

I have the following code, to handle when a key expire in redis: r.config_set('notify-keyspace-events', 'Ex') pubsub.psubscribe(**{"__keyevent@0__:expired": event_handler}) pubsub.run_in_thread(sleep_time=0.01) def event_handler(msg): …
Tlaloc-ES
  • 4,825
  • 7
  • 38
  • 84
1
vote
1 answer

Redis-py Read LOWEST_LATENCY or NEAREST

Redis-py Version: 4.2.0 How can we enable redis-py to read from the LOWEST_LATENCY node? We are using AWS global datastore so we want to enable redis-py to read from the nearest node from the geo-distributed nearest node?
angelokh
  • 9,426
  • 9
  • 69
  • 139
1
vote
0 answers

Redis Sentinel is not switching to new master

I want to implement redis-sentinel. Following code snippet shows what I have done: import redis from redis.sentinel import Sentinel from .config import redis_config redis_client = None def create_redis_client(): global redis_client …
hafiz031
  • 2,236
  • 3
  • 26
  • 48
1
vote
1 answer

How to aggregate the timestamp using redis timeseries module?

I need to create a per minute candlesticks aggregation of the price time series using the Redis time series module. I was able to aggregate most of the required columns like openPrice (using first), closePrice (using last), highPrice (using max),…
Taliat Kh
  • 11
  • 2
1
vote
0 answers

Redis keyspace notifications detect only newly created keys and not replaced

I am trying to be notified in redis when new key is created and not being notified when the key is updated/replaced. Is there a way to set notifications this way or is there any other way to be notified when only new key was created and not existing…
Arthur Zangiev
  • 1,438
  • 3
  • 14
  • 21
1
vote
2 answers

redis - how to create a transation

Background I need a way to create a transaction in REDIS, where if one command fails, I need the entire transaction to fail / rollback. I tried asking once before (REDIS- pipeline doesnt fail if one of the commands don't work) But perhaps I didn't…
dot
  • 14,928
  • 41
  • 110
  • 218
1
vote
0 answers

redis hash - how to save a sound file?

Can someone tell me how to save a file in redis? I'd like to be able to do something like: hmset 12345 sound_bytes as an example. I'm using python and so will need to open the mp3 file using python, save it as a byte…
dot
  • 14,928
  • 41
  • 110
  • 218
0
votes
0 answers

What is the encoding format used for keys written in binary-safe mode in Redis?

We have some redis Hash keys which are storing values as c++ structures and for that we have used binary safe mode. Example: redisReply* reply = (redisReply*)redisCommand(ctxt, "HMSET %b %b %b", KEY.c_str(), strlen(KEY.c_str()), &val, …
Neeraj
  • 11
  • 3
0
votes
1 answer

Pushing polar dataframe to redis

What is the best way to push a polars dataframe to redis ? Currently I am trying to read the _io.BytesIO buffer returned by write_ipc redis_instance.set("key",df.write_ipc(file = None, compression="lz4").read()) This doesn't seem to work as the key…
linus heinz
  • 339
  • 1
  • 3
  • 7
0
votes
1 answer

What's the recommended way to connect to Amazon MemoryDB for Redis programmatically?

I'm new to Redis and Amazon MemoryDB. Currently I'm able to spin up a Redis Cluster using Amazon MemoryDB, following the aws document. redis-cli works for me to link to my redis cluster (from another EC2 instance inside of the VPC): >> redis-cli -c…
1
2