I have a sync client set up (Python SDK) and I am writing a tuple(s) and I can get the write to work but I have no idea what the response object looks like or how I know its successful or not.
<openfga_sdk.client.models.write_response.ClientWriteResponse object at 0x00000202DD53A630>
Looks like there should be a success or error attribute from what I can understand is going on here. But I am not sure how to tell if it was successful or not and I am not sure what I am missing here.
Yah I am doing that. I can see it is writing the tuple to the store. However I have no idea what the response object looks like as I want to possibly add some handling on that.
Also while I am on the subject, can you specify an overwrite in the options on a write tuple? I can see if I try sending the same tuple that already exists its handing me this back, which I am assuming is a overwrite issue…
openfga_sdk.exceptions.ValidationException: (400)
Reason: Bad Request
On the write response you should be able to check for response.success
For the overwrite case you can’t directly do this by writing the changed tuple but you can pass a delete and a write in a request in order to update the value.
Traceback (most recent call last):
File "C:\Temp\openfga\src\openfga\main.py", line 110, in <module>
print(response.success)
^^^^^^^^^^^^^^^^
AttributeError: 'ClientWriteResponse' object has no attribute 'success'
@stephenbawks1 if you are not using the non-transactional mode, any failure will throw an exception, the very fact that none is thrown means it’s a success.
If you are using non-transactional mode, you will have to check the status on each element.