List mapping tables
Updated at:
Tablestore SDK for Go lists the names of mapping tables in the current instance.
Prerequisites
Install Tablestore SDK for Go and initialize a client. SQL query requires version 1.7.4 or later. We recommend that you use the latest version.
Description
Call the SQLQuery method to execute a SHOW TABLES statement and list mapping tables in the current instance.
func (client *TableStoreClient) SQLQuery(request *SQLQueryRequest) (*SQLQueryResponse, error)
response, err := client.SQLQuery(
&tablestore.SQLQueryRequest{Query: "SHOW TABLES"},
)
if err != nil {
log.Fatalf("SQLQuery failed: %v", err)
}
for response.ResultSet.HasNext() {
name, _ := response.ResultSet.Next().GetString(0)
fmt.Println(name)
}
Parameters
SQLQueryRequest contains the following parameters.
|
Name |
Type |
Description |
|
Query (required) |
string |
The |
Response
ResultSet contains the mapping table names. The result column is named Tables_in_<instance_name>, where <instance_name> is the instance name.
Is this page helpful?