You can call the UpdateTimeseriesTable operation to update the configurations of a time series table, such as the time to live (TTL).
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.
Parameters
For more information, see Create a time series table.
Example
/**
* Use UpdateTimeseriesTableSample to update the time to live (TTL) configuration of a time series table.
*/
func UpdateTimeseriesTableSample(client *tablestore.TimeseriesClient , timeseriesTableName string) {
fmt.Println("[Info]: Begin to update timeseries table !")
// Construct the TTL configuration of the time series table.
timeseriesTableOptions := tablestore.NewTimeseriesTableOptions(964000)
// Construct the update request.
updateTimeseriesTableRequest := tablestore.NewUpdateTimeseriesTableRequest(timeseriesTableName)
updateTimeseriesTableRequest.SetTimeseriesTableOptions(timeseriesTableOptions)
// Call the time series client to update the time series table.
updateTimeseriesTableResponse , err := client.UpdateTimeseriesTable(updateTimeseriesTableRequest)
if err != nil {
fmt.Println("[Error]: Update timeseries table failed with error: " , err)
return
}
DescribeTimeseriesTableSample(client , timeseriesTableName)
fmt.Println("[Info]: UpdateTimeseriesTableSample finished! RequestId: " , updateTimeseriesTableResponse.RequestId)
}