All Products
Search
Document Center

Tablestore:Delete a data table

Last Updated:Jun 24, 2025

This topic describes how to delete a data table from an instance by using Tablestore SDK for Go.

Usage notes

  • If a search index is created for a data table, you must delete the search index before you delete the data table.

  • If a secondary index is created for a data table, the secondary index is automatically deleted when you delete the data table.

  • Deleted data tables and secondary indexes cannot be restored. Proceed with caution.

Prerequisites

A client is initialized. For more information, see Initialize a Tablestore client.

Method description

func (tableStoreClient *TableStoreClient) DeleteTable(request *DeleteTableRequest) (*DeleteTableResponse, error)

DeleteTableRequest parameters

TableName (required) string: the name of the data table.

Sample code

The following sample code demonstrates how to delete a data table named test_table.

func DeleteTableSample(client *tablestore.TableStoreClient) {
    deleteRequest := new(tablestore.DeleteTableRequest)
    deleteRequest.TableName = "test_table"
    _, err := client.DeleteTable(deleteRequest)
    if (err != nil) {
        fmt.Println("Failed to delete table with error:", err)
    } else {
        fmt.Println("Delete table finished.")
    }
}

References

Delete a time series table