redis-om-python
redis-om-python copied to clipboard
added return_fields function, attempting to optionally limit fields r…
…eturned by find. Will solve #568 when completed.
Please add also exclude keyword, it'll be convenient
Are u going to finish it guys?
I tried to do it, and I found two main problems here:
- All fields that will not be returned must be Optional or have a default value. If not there will be an Exception here --- https://github.com/redis/redis-om-python/blob/main/aredis_om/model/model.py#L1473. It will not be clear for user. This can be validated in FindQuery init, but I don't have an idea, how to check it.
- Here is a problem with dict fields and embedded model --- it will be returned as JSON, and we will have a validation issue again.
address
Input should be a valid dictionary or object to extract fields from [type=model_attributes_type, input_value='{"pk":"01JM7319T5SP7A6YR...e":"11111","note":null}', input_type=str]
Refactored this feature to become a new only(*fields) and values(*fields) pair, following patterns from the Django ORM.