You can call the DeleteTable operation to delete a data table from an instance.
Prerequisites
An OTSClient instance is initialized. For more information, see Initialize an OTSClient instance.
A data table is created. For more information, see Create a data table.
The index tables and search indexes that are created for the data table are deleted.
API operation
/**
* Delete a data table based on the table name.
* @api
* @param [] $request The request parameters.
* @return [] The response is empty. If the DeleteTable operation succeeds, no message is returned. An empty array is returned to be consistent with other operations.
* @throws OTSClientException The exception that is thrown when a parameter error occurs or the Tablestore server returns a verification error.
* @throws OTSServerException The exception that is thrown when the Tablestore server returns an error.
*/
public function deleteTable(array $request);
Parameters
Request information
Request parameters
Parameter | Description |
table_name | The name of the data table. |
Request syntax
$result = $client->deleteTable([
'table_name' => '<string>', // REQUIRED
]);
Response information
Response parameters
The response is empty. If an error occurs, the system returns an exception.
Response syntax
[]
Examples
The following sample code provides an example on how to delete a data table:
$result = $otsClient->deleteTable([
'table_name' => 'MyTable'
]);
References
For more information about the API operation, see DeleteTable.
If an error occurs when you call this operation, search for the error cause in Error codes based on the error message and troubleshoot the error.