redis-py icon indicating copy to clipboard operation
redis-py copied to clipboard

[suggestion] support rediscluster schemes like `rediscluster://host:port/`

Open ramwin opened this issue 1 year ago • 2 comments

Version: 5.0.1

Platform: python 3.10.12 on Ubuntu 22.04.3 LTS

Description: The redis.RedisCluster works almost same as redis.Redis, So I suggest when the redis.Redis.from_url return a redis.RedisCluster instance where the url startswith rediscluster. the code looks like this

class Redis:
    @classmethod
    def from_url(cls, url: str, **kwargs) -> Unionr["Redis", "RedisCluster"]:
        if url.startswith("rediscluster"):
            return RedisCluster.from_url(url, **kwargs)
        ...

ramwin avatar Feb 08 '24 07:02 ramwin

I found that the host and schema was parse by urllib.parse.urlparse, so I changed the schema from redis_cluster to rediscluster

ramwin avatar Feb 08 '24 07:02 ramwin

I create a pr to support this schema. #3152

ramwin avatar Feb 20 '24 01:02 ramwin

This issue is marked stale. It will be closed in 30 days if it is not updated.

github-actions[bot] avatar Feb 20 '25 00:02 github-actions[bot]