Currently, the Table Store Python SDK adopts the
Exception method to handle errors. The operations is successful if the called interface does not throw an exception. If an exception is thrown, then the operation fails.
Note: Batch operation interfaces such as batch_get_row and batch_write_row are successfully called only when the system checks that the status of each row is successful.
The Table Store python SDK has two types of exceptions: OTSClientError and OTSServiceError inherited from Exception.
OTSClientError: Indicates an internal SDK exception, for example, incorrect parameter values or failure to return parsed results.
OTSServiceError: Indicates a server error generated by parsing a server error message. OTSServiceError has the following components:
get_http_status: Returned HTTP code, for example, 200 or 404.
get_error_code: Error type string returned by Table Store.
get_error_message: Error message string returned by Table Store.
get_request_id: UUID that uniquely identifies a request. If the problem persists, save the RequestId and open a ticket
The system retries the operation when an error occurs in the SDK. By default, the operation is retried 20 times at a maximum interval of three seconds. For more information about how the system retries the operation on throttling errors and read-related internal server errors, see
You can inherit RetryPolicy to customize a retry policy, and pass it in as a parameter when constructing OTSClient object.
SDK has the following retry policies:
- DefaultRetryPolicy: The default retry policy. Only the read operation is retried 20 times at a maximum interval of three seconds.
- NoRetryPolicy: No retry.
- NoDelayRetryPolicy: A retry policy without any delays. This policy must be used with caution.
- WriteRetryPolicy: The write operation is retried based on the default retry policy.