You can execute the describe statement to query information about tables, such as the field names and field types.

Note For more information about the describe statement, see Query the information about a table.



Parameter Description
query The SQL statement. Configure the parameter based on the required feature.


Execute the describe test_table statement to query information about the table named test_table.

func getTableDesc(client *tablestore.TableStoreClient) {
    // Create a SQL request. 
    request := &tablestore.SQLQueryRequest{Query: "describe test_table"}

    // Obtain the response to the SQL request. 
    response, err := client.SQLQuery(request)
    if err != nil {

    // Obtain the schema of the returned results of the SQL request. 
    columns := response.ResultSet.Columns()
    fmt.Printf("response table schema: %v\n", columns)

    // Use SQL ResultSet to obtain all returned results of the SQL request. 
    fmt.Println("response resultset:")
    resultSet := response.ResultSet
    for resultSet.HasNext() {
        row := resultSet.Next()
        for i := range columns {
            if i > 0 {
                fmt.Printf(", ")
            value, err := row.GetString(i)
            if err != nil {

Sample output:

response table schema: [Field:STRING Type:STRING Null:STRING Key:STRING Default:STRING Extra:STRING]
response resultset:
pk, varchar(1024), NO, PRI, ,
long_value, bigint(20), YES, , ,
double_value, double, YES, , ,
string_value, mediumtext, YES, , ,
bool_value, tinyint(1), YES, , ,