Delete a data table from an instance by using Tablestore SDK for .NET.
Usage notes
If the data table has a search index, delete the search index before deleting the data table.
If the data table has secondary indexes, they are automatically deleted when you delete the data table.
Deleted data tables and their secondary indexes cannot be recovered. Proceed with caution.
Prerequisites
A client is initialized. For more information, see Initialize a Tablestore client.
Method description
Synchronous method:
public DeleteTableResponse DeleteTable(DeleteTableRequest request)
Asynchronous method:
public Task<DeleteTableResponse> DeleteTableAsync(DeleteTableRequest request)
Sample code
The following example deletes a data table named test_table.
try
{
DeleteTableRequest request = new DeleteTableRequest("test_table");
client.DeleteTable(request);
Console.WriteLine("Delete table succeeded.");
}
catch (Exception ex)
{
Console.WriteLine($"Delete table failed, exception:{ex.Message}");
}