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

Note For more information about the ListTable operation, see ListTable.

Prerequisites

  • A Tablestore client is initialized. For more information, see Initialization.
  • A data table is created.

API operations

/**
 * 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 format

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

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

Result format

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

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

Examples

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

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