You can call the CreateTimeseriesAnalyticalStore operation to create an analytical store for an existing time series table to store and analyze time series data at low costs.
Prerequisites
An instance for the TimeSeries model is created in a region that supports the analytical store feature. For more information, see Create an instance for the TimeSeries model.
A client is initialized. For more information, see Initialize a Tablestore client.
Parameters
Parameter | Description |
timeseriesTableName | The name of the time series table. |
analyticalStore | The configuration of the analytical store, which includes the following sub-parameters.
|
Example
The following sample code provides an example on how to create an analytical store for the test_timeseries_table time series table. The analytical store is named test_analytical_store, with a TTL of 30 days (2592000 seconds), and the synchronization option set to SYNC_TYPE_INCR.
func CreateTimeseriesAnalyticalStore(client *tablestore.TimeseriesClient) {
//Specify the name of the analytical store.
analyticalStore := tablestore.NewTimeseriesAnalyticalStore("test_analytical_store")
//Specify the TTL of the analytical store in seconds.
analyticalStore.SetTimeToLive(2592000)
//Specify the mode in which the data in the time series table is synchronized to the analytical store.
analyticalStore.SetSyncOption(tablestore.SYNC_TYPE_INCR)
//Specify the name of the time series table.
request := tablestore.NewCreateTimeseriesAnalyticalStoreRequest("test_timeseries_table", analyticalStore)
_, err := client.CreateTimeseriesAnalyticalStore(request)
if err != nil {
log.Fatal(err)
}
}