All Products
Search
Document Center

Tablestore:Delete tables

Last Updated:Mar 04, 2024

You can call the DeleteTable operation to delete a table from an instance.

Note

For more information about the DeleteTable operation, see DeleteTable.

Prerequisites

  • The OTSClient instance is initialized. For more information, see Initialize an OTSClient instance.

  • A table is created.

  • The index tables and search indexes for the table are deleted.

Operations

def delete_table(self, table_name):

Parameters

Parameter

Description

table_name

The name of the table.

Examples

The following code provides an example on how to delete a specified table:

try:
    # Call the operation to delete the table named SampleTable.
    ots_client.delete_table('SampleTable')
    # If the task succeeds, no exception is returned.
    print("delete table succeeded")
except Exception:
    # If the task fails, an exception is returned for you to handle.
    print("delete table failed")         

For the detailed sample code, visit DeleteTable@GitHub.