redis-om-python
redis-om-python copied to clipboard
Improve query parameters
The current implementation of the find method requires manually passing a table name Customer followed by the name of the column last_name which seems redundant. For instance, the following query:
Customer.find(Customer.last_name == "Brookins").all()
Should be simplified as:
Customer.find(last_name == "Brookins").all()
The find method is already being performed on the Customer table, so no need to specify Customer in the parameter. Not sure about the complexity that this feature will introduce, but, ideally, users should not specify the Customer table in the arguments.
think the python interpreter would complain because last_name is not declared anywhere
I don't think so cause the whole thing within the parenthesis is evaluated as a custom expression:
https://github.com/redis/redis-om-python/blob/60f102d18829b35604bdb5efb3a18679b39d16da/aredis_om/model/model.py#L1188-L1189
It can be customized by changing the left field of the following class:
https://github.com/redis/redis-om-python/blob/60f102d18829b35604bdb5efb3a18679b39d16da/aredis_om/model/model.py#L218-L223