redisco
redisco copied to clipboard
unicode attributes / keys
Throughout the entire code base redisco requires that keys and indexed attributes be unicode.
This makes absolutely no sense since Redis supports any binary strings and redisco cannot be used to store / index binary data without unnecessary encoding overhead.
The suggestion is to purge unicode requirements from every place in the code base.
Any suggestions on how to audit the codebase for this, and what unicode strategy to use (especially WRT python3, where things like CharField probably should be unicode, it probably makes sense in a couple of other places too) ?
I am not sure that this request is in the scope of an ORM based on Redis. Any specific cases where developers need to store data in binary format ?
It's easy enough to think of something like ImageField, possibly extending a BytesField, along with other data-science type fields.
For other fields, it could mean deciding if they are unicode, bytes or "target_type".
CharField is obviously unicode, most other things could probably be bytes, except for things like ListField that have a target_type.
No idea how things like ReferenceField would work.
To see the current state: try running under python3, with decode_responses=False and see what breaks (just about everything).
I really think that storing binary in redis is outside the scope of the ORM. There are tons of ways to handle this. For an image, let's store a path ... and so on.