All Products
Search
Document Center

Tablestore:Query the description of a table

Last Updated:Jun 28, 2024

You can call the DescribeTable operation to query the description of a table, such as the schema information, reserved read throughput, and reserved write throughput.

Prerequisites

API operation

// Query the description of a table by using the table name. 
DescribeTable(request *DescribeTableRequest) (*DescribeTableResponse, error)    

Parameters

Parameter

Required

Description

TableName

Yes

The name of the table

Examples

The following sample code provides an example on how to query the max versions and time to live (TTL) of a table:

func DescribeTableSample(client *tablestore.TableStoreClient, tableName string){
    describeTableReq := new(tablestore.DescribeTableRequest)
    describeTableReq.TableName = tableName
    describ, err := client.DescribeTable(describeTableReq)
    if err != nil {
        fmt.Println("failed to update table with error:", err)
    } else {
        fmt.Println("DescribeTableSample finished. Table meta:", describ.TableOption.MaxVersion, describ.TableOption.TimeToAlive)
    }
} 

References

  • For information about the API operation that you can call to query the description of a table, see DescribeTable. For the detailed sample code, visit DescribeTable@GitHub.

  • You can call API operations to read and write data in a data table. For more information, see Basic operations on data.

  • You can update a table to modify the information about the table, such as the time to live (TTL) and max versions. For more information, see Update a table.

  • You can delete a data table that you no longer require. For more information, see Delete tables.