You can call the DescribeTimeseriesTable operation to query the information about a time series table, such as the time to live (TTL) configuration.
Prerequisites
- A time series table is created. For more information, see Create a time series table.
- The TimeseriesClient is initialized. For more information, see Initialization.
Parameter
Parameter | Description |
timeseriesTableName | The name of the time series table. |
Example
Query the information about a time series table named test_timeseries_table.
/**
* Call the DescribeTimeseriesTableSample operation to query the information about a time series table. The name of the time series table is specified by the timeseriesTableName parameter.
*/
func DescribeTimeseriesTableSample(client *tablestore.TimeseriesClient, timeseriesTableName string) {
fmt.Println("[Info]: Begin to require timeseries table description!")
describeTimeseriesTableRequest := tablestore.NewDescribeTimeseriesTableRequset(timeseriesTableName) // Construct a request and specify the name of the time series table.
describeTimeseriesTableResponse, err := client.DescribeTimeseriesTable(describeTimeseriesTableRequest)
if err != nil {
fmt.Println("[Error]: Failed to require timeseries table description!")
return
}
fmt.Println("[Info]: DescribeTimeseriesTableSample finished. Timeseries table meta: ")
fmt.Println("[Info]: TimeseriesTableName: ", describeTimeseriesTableResponse.GetTimeseriesTableMeta().GetTimeseriesTableName())
fmt.Println("[Info]: TimeseriesTable TTL: ", describeTimeseriesTableResponse.GetTimeseriesTableMeta().GetTimeseriesTableOPtions().GetTimeToLive())
// If you create an analytical store when you create a time series table, you can run the following code to query the information about the analytical store:
analyticalStores := describeTimeseriesTableResponse.GetAnalyticalStores()
for _, analyticalStore := range analyticalStores {
fmt.Println("[Info]: AnalyticalStoreName: ", analyticalStore.StoreName)
if analyticalStore.TimeToLive != nil {
fmt.Println("[Info]: TimeToLive: ", *analyticalStore.TimeToLive)
}
if analyticalStore.SyncOption != nil {
fmt.Println("[Info]: SyncOption: ", *analyticalStore.SyncOption)
}
}
}