There seems to be no direct way in Redis OM to relay nx from .save() to the underlying Redis SET call.
In the Redis OM source this is what the save looks like:
def save(
self: "Model", pipeline: Optional[redis.client.Pipeline] = None
) -> "Model":
self.check()
db = self._get_db(pipeline)
db.json().set(self.key(), Path.root_path(), json.loads(self.json()))
return self
There is no argument in save that allows me to set the nx flag and pass it downstream to the .set(...) call.
set does have an nx flag option, but the wrapper save method does not.
def set(
self,
name: str,
path: str,
obj: JsonType,
nx: Optional[bool] = False,
xx: Optional[bool] = False,
decode_keys: Optional[bool] = False,
) -> Optional[str]: