You can call the DeleteTable operation to delete a data table from an instance.
For more information, see DeleteTable.
Usage notes
You cannot restore deleted data tables. Proceed with caution.
When you delete a data table, the data in the data table and the secondary indexes that are created for the data table are deleted. You cannot restore deleted data or secondary indexes. Proceed with caution.
Prerequisites
An OTSClient instance is initialized. For more information, see Initialize an OTSClient instance.
A data table is created. For more information, see Create data tables.
The index tables and search indexes that are created for the data table are deleted. For more information, see Delete search indexes.
API operation
/// <summary>
/// Delete a data table based on the table name.
/// </summary>
/// <param name="request">Request parameter, including the table name.</param>
/// <returns>Information returned by DeleteTable. The result is null.
/// </returns>
public DeleteTableResponse DeleteTable(DeleteTableRequest request);
/// <summary>
/// The asynchronous mode of DeleteTable.
/// </summary>
public Task<DeleteTableResponse> DeleteTableAsync(DeleteTableRequest request);
Examples
The following sample code provides an example on how to delete a data table:
var request = new DeleteTableRequest("SampleTable");
try
{
otsClient.DeleteTable(request);
Console.Writeline("Delete table succeeded.");
}
catch (Exception ex)
{
Console.WriteLine("Delete table failed, exception:{0}", ex.Message);
}
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.