aio-libs-abandoned/aioredis-py

zrevrangebyscore in aioredis in different than in redis

91DarioDev opened this issue · 2 comments

Describe the bug

I had my code running with redis-py in the version sync.
I added asycn/await everywhere and replaced the import of redis with aioredis.

zrevrangebyscore after that started returning no results, empty list, despite with redis-py sync it was returning values correctly!

now my code was with async/await so I tried to use

from redis import asyncio as aioredis

And magically zrevrangebyscore is returning results as expected again.

So I think there is some difference between the version implemented in redis-py and aioredis. What is the difference?

Anyways I fixed using redis-py in his async version.

aioredis version 2.0.1
redis-py version 4.3.4

To Reproduce

use zrevrangebyscore in aioredis and redis

Expected behavior

working the same way between aioredis and redis-py

Logs/tracebacks

no errors just empty list

Python Version

$ python --version
3.10

aioredis Version

$ python -m pip show aioredis
2.0.1

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
boh5 commented

Same problem, this bug has not been fixed until version 2.0.1

boh5 commented

According to README, aioredis is now in redis-py 4.2.0rc1+. So you should use redis instead of aioredis.

from redis import asyncio as aioredis

But there seems to be a bug in pycharm, it warns that Cannot find reference 'asyncio' in '__init__.pyi'

Update: fix pycharm import warning
According to redis-py issues

you can install types-redis it solves the problem