Query table information
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) |
|
The table name. |
Response
DescribeTableResponse contains the following business information.
|
Field |
Type |
Description |
|
|
|
The table schema, including the table name, primary key columns, predefined columns, and table ID. |
|
|
|
The table configurations, including the time to live (TTL), maximum number of versions, maximum version offset, update permissions, and full-row update setting. |
|
|
|
The reserved read and write throughput. |
|
|
|
The Stream status, Stream ID, expiration time, last enablement time, and original columns. |
|
|
|
The secondary index information. |
|
|
|
The server-side encryption status, key type, key ID, and RAM role ARN. |