All Products
Search
Document Center

Tablestore:Query the names of tables

Last Updated:Mar 27, 2024

You can call the ListTable operation to query the names of all tables that are created in the current instance.

Note

For information about the operation, see ListTable.

Prerequisites

API operation

"""
Description: You can call this operation to query the names of all tables. 
Return value: the table name list. 
"table_list" indicates the table name list of the tuple type. Example: ('MyTable1', 'MyTable2'). 
"""
def list_table(self):            

Sample code

The following sample code provides an example on how to query the names of all tables in an instance:

try:
    list_response = ots_client.list_table()
    print("table list:")
    for table_name in list_response:
        print(table_name)
    print("list table succeeded")
except Exception:
    print("list table failed.") 
    

For the detailed sample code, visit ListTable@GitHub.

References

  • You can call the DescribeTable operation to query the description of a table, such as the schema and reserved read or write throughput. For more information, see Query the description of a table.

  • You can call the DeleteTable operation to delete a table you no longer require. For more information, see Delete tables.