All Products
Search
Document Center

Tablestore:List the names of tables

Last Updated:Aug 19, 2024

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

Prerequisites

API operations

 /// <summary>
 /// Query the names of all tables created in the current instance. 
 /// </summary>
 /// <param name="request">Request parameters.</param>
 /// <returns>The table name list returned by the ListTable operation.</returns> </returns>
 public ListTableResponse ListTable(ListTableRequest request);

 /// <summary>
 /// Asynchronous mode of ListTable. 
 /// </summary>
 public Task<ListTableResponse> ListTableAsync(ListTableRequest request);           

Examples

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

 var request = new ListTableRequest();
 try
 {
     var response = otsClient.ListTable(request);
     foreach (var tableName in response.TableNames)
     {
         Console.WriteLine("Table name:{0}", tableName);
     }
     Console.WriteLine("List table succeeded.");
 }
 catch (Exception ex)
 {
     Console.WriteLine("List table failed, exception:{0}", ex.Message);
 }            

References

For information about the API operation that you can call to create a data table, see CreateTable.

  • You can update a table to modify the information about the table, such as the TTL and max versions. For more information, see UpdateTable.

  • You can call API operations to read and write data in a data table. For more information, see Basic operations on data.

  • You can query the description of a table to view the configuration information about the table, such as the max versions and TTL. For more information, see Query the description of a table.

  • You can delete a data table that you no longer require. For more information, see Delete a data table.