You can call the DescribeTimeseriesTable operation to query information of 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.
A TimeseriesClient instance is initialized. For more information, see Initialize an OTSClient instance.
Parameters
Parameter | Description |
timeseriesTableName | The name of the time series table. |
Example
The following sample code provides an example on how to query information of a time series table:
private static void describeTimeseriesTable(TimeseriesClient client) {
// Specify the name of the time series table.
String tableName = "<TIMESERIES_TABLE>";
DescribeTimeseriesTableResponse describeTimeseriesTableResponse = client.describeTimeseriesTable(new DescribeTimeseriesTableRequest(tableName));
TimeseriesTableMeta tableMeta = describeTimeseriesTableResponse.getTimeseriesTableMeta();
// View the name of the time series table.
System.out.println(tableMeta.getTimeseriesTableName());
// View the status of the time series table.
System.out.println(tableMeta.getStatus());
// View the TTL configuration of the time series table.
System.out.println(tableMeta.getTimeseriesTableOptions().getTimeToLive());
// View the TTL configuration of time series metadata.
System.out.println(tableMeta.getTimeseriesMetaOptions().getMetaTimeToLive());
// Check whether updates to attributes of time series metadata are allowed.
System.out.println(tableMeta.getTimeseriesMetaOptions().getAllowUpdateAttributes());
// If you have created an analytical store for the time series table, you can use the following code to obtain the analytical store information.
List<TimeseriesAnalyticalStore> analyticalStores = describeTimeseriesTableResponse.getAnalyticalStores(); // View the analytical storage configuration of the time series table.
for (TimeseriesAnalyticalStore store : analyticalStores) {
// View the name of the analytical store.
System.out.println(store.getAnalyticalStoreName());
// View the TTL configuration of the analytical store.
System.out.println(store.getTimeToLive());
// View the synchronization configuration of the analytical store.
System.out.println(store.getSyncOption());
}
}