Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

RedisJSON / ReJSON #753

Closed
bitnom opened this issue May 24, 2020 · 6 comments
Closed

RedisJSON / ReJSON #753

bitnom opened this issue May 24, 2020 · 6 comments
Labels
need investigation Need to look into described issue.

Comments

@bitnom
Copy link

bitnom commented May 24, 2020

Version: 1.3.1

I know that there are not currently any methods for rejson aka RedisJSON. This is a feature request for that and question of:

Should it be okay to use the interface classes (Such as execute) for now to use rejson?

@agentspawn
Copy link

This could help: https://gist.github.com/agentspawn/269559fb75aa01a28e94f6416296c4fa

@bitnom
Copy link
Author

bitnom commented May 25, 2020

Made this branch. Haven't tested yet.

@bitnom
Copy link
Author

bitnom commented May 25, 2020

I'm having trouble getting it working. When I use the class on its own by passing an aioredis connection to my class, it works but when I try to use it as part of aioredis: https://github.com/shaqarava/aioredis/blob/rejson/aioredis/commands/rejson.py I get an error on my first attempt.

result = await redis.jmget('mykey1', 'mykey2', path='.')

Throws error of wrong number of variables (2) passed to json.dumps where it expects 1. Which is weird since that method uses loads though I'm going off of memory. Will test again later. Anyone want to help make this into a PR?

The JSON encoder/decoder import handling should be moved elsewhere.

@Andrew-Chen-Wang
Copy link
Collaborator

Prob won't become a PR since it's not integrated with Redis itself, so not testable for us maybe perhaps... (e.g. planning on moving to a structure similar to redis-py, but the Redis-lab docs shows to use execute_command since redis-py just doesn't offer this)?

Besides that, I think you might've just forgot where the error is coming from...? It could also be because you've been returned None rather than a list (not tested, but also not likely).

@Andrew-Chen-Wang Andrew-Chen-Wang added the need investigation Need to look into described issue. label Jan 8, 2021
@romkazor
Copy link

Throws error of wrong number of variables (2) passed to json.dumps where it expects 1. Which is weird since that method uses loads though I'm going off of memory. Will test again later. Anyone want to help make this into a PR?

If replace json with a ujson that everything is OK.

@seandstewart
Copy link
Collaborator

As of #891 this library is a full asyncio port of redis-py, so any examples found in Redis Labs' documentation should Just Work ™️ . Likely the issue here was that you needed your json encoded to bytes, which ujson does by default, I believe.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need investigation Need to look into described issue.
Projects
None yet
Development

No branches or pull requests

5 participants