cunla / fakeredis-py

Implementation of Redis in python without having a Redis server running. Fully compatible with using redis-py.
https://fakeredis.moransoftware.ca/
BSD 3-Clause "New" or "Revised" License
281 stars 47 forks source link

Missing get_fake_connection #261

Closed jlopespt closed 9 months ago

jlopespt commented 9 months ago

Got this error message:

from fakeredis import get_fake_connection E ImportError: cannot import name 'get_fake_connection' from 'fakeredis' (/usr/local/lib/python3.9/site-packages/fakeredis/init.py)

Noticed that this function was removed from the repository (commit 888adc0).

Was this intentional? What is the alternative to it?

Many thanks for any feedback!

cunla commented 9 months ago

Hi,

I realized I needed to maintain this method whenever there were changes in django-rq, and I wanted to avoid it. I still listed it in the documentation here. You can maintain this as part of your code (for me personally, I wanted the option of using UNIX_SOCKET_PATH instead of URL).

It would be great if django-rq would have a redis_cls parameters.

Alternatively, if you don't want to maintain the logic for the override method, you can override redis.Redis and redis.StrictRedis before calling django-rq.

cunla commented 9 months ago

@jlopespt did you manage? can this be closed?

jlopespt commented 9 months ago

Hi @cunla yes, we adapted our code. Thanks for the feedback and follow up!