I have a sorted set in Redis. I am trying to update the counter value of a specific element by using zincrby in Python code like:
conn.zincrby("usersSet", float(1), "user1")
But it is showing an error as : 'Error: value is not a valid float'
I tried the same command on cli : zincrby usersSet 1 users1 And it is working correctly. Is there any other method in Python code to increase the counter value of the specific key in the sorted set.
Parameters order are differ between redis-cli and python connector. You have to write conn.zincrby("usersSet", "user1", 1)
The python redis library was updated to match redis-cli's order of arguments.
Hence, conn.zincrby("usersSet", 1, "user1")
will be the correct usage now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With