By calling the UpdateTimeseriesTable operation, you can update the configuration information of a time series table or time series metadata, such as the time to live (TTL) configuration.
Usage notes
The TimeSeries model is supported by Tablestore SDK for Python V6.1.0 and later. Make sure that you have obtained a correct version of Tablestore SDK for Python.
NoteFor more information, see Version history of Tablestore SDK for Python.
You cannot change the configuration information of a time series table (timeseries_table_options) and time series metadata (timeseries_meta_options) at the same time. You can change only one of them in a single call.
Prerequisites
A Tablestore client is initialized. For more information, see Initialize a Tablestore client.
Parameters
Parameter | Description |
table_meta (Required) | The schema information of the time series table. The schema information consists of the following items:
|
Example
The following sample code provides an example on how to update the TTL of a time series table:
try:
# Set the TTL of data in the time series table to 604,800 seconds (seven days).
tableOption = TimeseriesTableOptions(604800)
tableMeta = TimeseriesTableMeta("", tableOption)
# Call the operation to update the time series table.
otsClient.update_timeseries_table(tableMeta)
print("update timeseries table success.")
except Exception as e:
# If an exception is thrown, the update fails. Handle the exception.
print("update timeseries table failed. %s" % e)