Questions tagged [redis-py]

A Python interface to the Redis key-value store.

A Python interface to the Redis key-value store.

redis-py is developed and maintained by Andy McCurdy (sedrik@gmail.com).

It can be installed in your python environment using pip install redis or if you download the source from above link you can run python setup.py install

221 questions
0
votes
1 answer

python redis scan and flush caused lock?

I used redis for synchronize some datas. Precondition : Data inserted into redis continuously. (About 30,000 in 10 minutes) Here is work flow that execute every 5 minutes. Scan keys by specific pattern(ex. 'users*') Get all values by keys Flush all…
Hide
  • 3,199
  • 7
  • 41
  • 83
0
votes
1 answer

Two class methods were same functionally but got an different name

When using redis sorted set, I want to make class methods more readable. In redis-py, especially in sorted set, push and update operation work same. For example, class A(object): def push(self, key, value, score): return redis.zadd(key,…
sogo
  • 351
  • 5
  • 20
0
votes
1 answer

Why are redis pub and sub considered different clients when only one connection is opened?

How come that even when only one instance of Redis connection created, every time I call publish or subscribe on that instance, it counts it like another client. So when I connect to redis using python import redis redis_server = redis.Redis() it…
ammar
  • 64
  • 6
0
votes
1 answer

Defining Redis Database at Runtime

I am using the Redis client for Python called Redis-py. The GitHub library is located here https://github.com/andymccurdy/redis-py. I was wondering if there was any way to set the Redis database initialization values at runtime. For example, if I…
Yang K
  • 407
  • 4
  • 13
0
votes
0 answers

python redis rpush for loop failed

I use redis in python. I try to insert file names into redis. Here's how I do it: onlyfiles = [f for f in os.listdir(".") if f.endswith('.txt') and os.path.isfile(os.path.join(".", f))] for x in onlyfiles: r.rpush('filename', x) My code…
roscoe_x
  • 609
  • 1
  • 9
  • 16
0
votes
0 answers

Redis Sentinel Readonly Slave with no Auth

Setup: I have three machines with co-located Sentinel/Redis, exactly as in example-2, configured with sentinel auth-pass, masterauth, requirepass. -- failover, read/write -- all works. Requirement: I want to add in a Redis slave (4th instance of…
mushipao
  • 376
  • 5
  • 7
0
votes
1 answer

Is there a Redis-py function to get all secondary values

I want to create a simple registration using a redis database. For this the user should not be able to register with an existing username/email. Say I use the username as the primary key, how would I check if any secondary values include the email…
user233219
  • 11
  • 2
0
votes
1 answer

Unable to connect to Redis instance running on Azure Linux VM from Python

I created an Ubuntu VM on Azure. In its inbound networking filters, I added ports 22 (for SSHing) and 6379 (for Redis). Following this, I SSHed into an instance from my bash shell, downloaded, built and installed Redis from source. The resultant…
SexyBeast
  • 7,913
  • 28
  • 108
  • 196
0
votes
1 answer

How to know the operation of a notification message when I subscribe redis database?

I'm using redis-py. I subscribe to redis database and read notification like this: >>> p.psubscribe("__keyspace@{}__:*".format(...)) >>> for message in p.listen(): ... # do something with the message I want to get the operation of the message,…
batmancn
  • 457
  • 3
  • 15
0
votes
0 answers

Redis PSUBSCRIBE Problems

A server is sending a message via Redis on a channel composed of some name and a unique id. I need to essentially find this channel and publish something back to it. So far, I tried reading the documentation and experimenting with PSUBSCRIBE.…
0
votes
1 answer

Use the output "SMEMBERS" command as input to "MGET" in redis?

I am using redis-py (python redis library) in my code and would like to use the strings output by an SMEMBERS command directly in an MGET command. I would like to do this without pulling all of the members into my python program, and then sending…
mgallagher
  • 466
  • 6
  • 14
0
votes
2 answers

Increment value of a hash field in Redis using Python

I have created a hash in redis in python as follows: r.hmset('list:123', {'name': 'john', 'count': 5}) How can I increment the value of count for the key list:123?
John Paul
  • 75
  • 2
  • 8
0
votes
1 answer

redis python scan_iter giving different keys

Using redis python client, I want to list all of the keys with a certain pattern using scan_iter(). import redis r = redis.StrictRedis(host=host, port=port, db=db) count = 0 for key in r.scan_iter(match='pattern'): count += 1 …
jeicoo
  • 83
  • 1
  • 10
0
votes
1 answer

How python redis client encode data before saving to redis

Using redis-py, I saved key-value to redis,for exp, 'gdf': 'gdfgdfgq' to redis. I could retrieve that the value by the key after that. But when I retrieved the value through redis-cli, I got "\x80\x02X\a\x00\x00\x00gdfgdfgq\x01.". What is this? Why…
achilles
  • 327
  • 5
  • 16
0
votes
2 answers

Selecting rows from ndarray via bytearray

I have a bytearray that is pulled from redis. r.set('a', '') r.setbit('a', 0, 1) r.setbit('a', 1, 1) r.setbit('a', 12, 1) a_raw = db.get('a') # b'\xc0\x08' a_bin = bin(int.from_bytes(a, byteorder="big")) # 0b1100000000001000 I want to use that…
Jacob Eggers
  • 9,062
  • 2
  • 25
  • 43