You can execute the SHOW TABLES statement to list the names of mapping tables that are created for tables in the current instance.
For more information about the SHOW TABLES statement, see List mapping table names.
Prerequisites
-
A Tablestore client is initialized. For more information, see Initialize a Tablestore client.
-
A mapping relationship is created. For more information, see Create a mapping relationship.
Usage notes
The SQL query feature is supported by Tablestore SDK for PHP V5.1.0 and later. When you use the SQL query feature, make sure that a supported version of Tablestore SDK for PHP is installed.
For information about the version history of Tablestore SDK for PHP, see Version history of Tablestore SDK for PHP.
Examples
The following sample code provides an example on how to execute the SHOW TABLES statement to list the names of mapping tables that are created for tables in an instance.
$request = array(
'query' => "SHOW TABLES;",
);
$response = $otsClient->sqlQuery ($request);
$sqlRows = $response['sql_rows'];
print json_encode($sqlRows, JSON_PRETTY_PRINT);
References
After you query the names of the mapping tables, perform operations based on your business requirements.
-
To use a mapping table to query data that meets specific conditions, execute the
SELECTstatement. For more information, see Query data. -
To query details of a mapping table such as field names and field types, execute the
DESCRIBEstatement. For more information, see Query information about a table. -
To update the attribute column of a mapping table after an attribute column of the data table is changed, execute the
ALTER TABLEstatement. For more information, see Update attribute columns of mapping tables. -
To delete a mapping table, execute the
DROP MAPPING TABLEstatement. For more information, see Delete mapping tables.