Open vbabiy opened 2 years ago
+1 on this, any solution yet? 🙏
+1 This is essentially the same issue as https://github.com/redis/redis-om-python/issues/38
This is being worked on - but in the meantime if you can, this issue only applies to HashModels and you can swap it for a JsonModel and it will work
@sav-norem we are hosted on GCP and memorystore doesn't have support for JSON yet.
on
my way, i do it like this:
class BaseModel(HashModel, ABC): class Meta: global_key_prefix = "customer-dashboard" database = redis
@classmethod
def parse_obj(cls, obj: Any):
for name, field in cls.__fields__.items():
if not field.required and obj[name]=="":
obj[name] = None
return super().parse_obj(obj)
class TestObject(BaseModel): name: str age: int weight: Optional[float] = None
If was able to write it I should be able to read it.