All Products
Search
Document Center

Tablestore:Delete a data table

Last Updated:Jun 26, 2025

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

Usage notes

  • If a search index is created for a data table, you must delete the search index before you can 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.

  • After a data table and its secondary index are deleted, they cannot be recovered. Proceed with caution.

Prerequisites

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

Method description

def delete_table(self, table_name)

table_name parameter description

table_name (required) str: The name of the data table.

Sample code

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

try:
    client.delete_table('test_table')
    print("Delete table succeeded.")
except Exception as e:
    print("Delete table failed. %s" % e)

References

For more information, see Delete a time series table.