Query table information

Updated at:

Use the Tablestore SDK for Go to query the schema, configurations, Stream settings, encryption settings, reserved throughput, and secondary indexes of a table.

Prerequisites

Install the Tablestore SDK for Go and initialize the client.

Description

Call DescribeTable to query the schema and configurations of a table.

func (tableStoreClient *TableStoreClient) DescribeTable(request *DescribeTableRequest) (*DescribeTableResponse, error)

The following sample queries information about the example_table table and prints the main response fields.

request := &tablestore.DescribeTableRequest{
    TableName: "example_table",
}

response, err := client.DescribeTable(request)
if err != nil {
    log.Fatal(err)
}

fmt.Println("Table metadata:", response.TableMeta)
fmt.Println("Table options:", response.TableOption)
fmt.Println("Stream details:", response.StreamDetails)
fmt.Println("Encryption details:", response.SSEDetails)
fmt.Println("Reserved throughput:", response.ReservedThroughput)
fmt.Println("Secondary indexes:", response.IndexMetas)

Parameters

DescribeTableRequest contains the following parameter.

Name

Type

Description

TableName (required)

string

The table name.

Response

DescribeTableResponse contains the following business information.

Field

Type

Description

TableMeta

*TableMeta

The table schema, including the table name, primary key columns, predefined columns, and table ID.

TableOption

*TableOption

The table configurations, including the time to live (TTL), maximum number of versions, maximum version offset, update permissions, and full-row update setting.

ReservedThroughput

*ReservedThroughput

The reserved read and write throughput.

StreamDetails

*StreamDetails

The Stream status, Stream ID, expiration time, last enablement time, and original columns.

IndexMetas

[]*IndexMeta

The secondary index information.

SSEDetails

*SSEDetails

The server-side encryption status, key type, key ID, and RAM role ARN.