All Products
Search
Document Center

Tablestore:Query the names of tables

Last Updated:Aug 14, 2024

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

Prerequisites

API operation

/**
 * Query the names of all tables created in the current instance. 
 * @api
 * @param [] $request The request parameters, which are empty. 
 * @return [] The response.  
 * @throws OTSClientException The exception that is thrown when a parameter error occurs or the Tablestore server returns a verification error. 
 * @throws OTSServerException The exception that is thrown when the Tablestore server returns an error. 
 */
public function listTable(array $request); 

Request syntax

The request parameters are empty. You do not need to specify request parameters.

$result = $client->listTable([]);   

Response syntax

A STRING list is returned. Each item in the list is a table name.

[
    '<string>',
    '<string>',
    '<string>'
]        

Examples

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

$result = $otsClient->listTable([]);         

References

  • For information about the API operation that you can call to query the names of tables, see ListTable.

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

  • You can call API operations to read and write data in a 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.