Use Tablestore SDK for Java to list all mapping tables in the current Tablestore instance.
Prerequisites
Install the Tablestore SDK for Java and initialize a client.
Use Tablestore SDK for Java 5.13.0 or later.
Description
Call the sqlQuery method to execute a SHOW TABLES statement and query the names of all mapping tables in the current Tablestore instance.
SQLQueryResponse sqlQuery(SQLQueryRequest request)
The following example lists the mapping tables in the current instance and calls SQLUtils.parseShowTablesResponse to parse the result into a list of mapping table names.
SQLQueryRequest request = new SQLQueryRequest("SHOW TABLES");
SQLQueryResponse response = client.sqlQuery(request);
List<String> mappingTables = SQLUtils.parseShowTablesResponse(response);
for (String mappingTable : mappingTables) {
System.out.println(mappingTable);
}
Parameters
SQLQueryRequest contains the following parameter.
|
Name |
Type |
Description |
|
query (required) |
String |
The |
Response
SQLQueryResponse contains the following fields related to the mapping table list.
|
Field |
Type |
Description |
|
|
SQLStatementType |
Call |
|
|
ByteString |
The serialized list of mapping table names. Call |