Call the UpdateTimeseriesMeta operation to update properties in time series metadata. If the specified time series metadata does not exist, it is created automatically. You can update metadata for multiple time series in a single call.
Prerequisites
Before you begin, ensure that you have:
A Tablestore client initialized. For more information, see Initialize a Tablestore client.
Parameters
The request parameter supports the following fields.
|
Parameter |
Description |
|
timeseries_tablename (Required) |
The name of the time series table. |
|
metas (Required) |
A list of time series metadata objects. Each object contains a time series identifier and time series properties.
|
Example
The following example updates properties in the metadata of a time series.
# Define the tags that identify the time series.
tags = {"tag1": "t1", "tag2": "t2"}
# Build the time series identifier.
key = TimeseriesKey("measure1", "datasource1", tags)
# Define the properties to update.
attri = {"aaa": "bbb", "ccc": "ddd"}
try:
meta = TimeseriesMeta(key, attri)
request = UpdateTimeseriesMetaRequest("<TIMESERIES_TABLE_NAME>", [meta])
# Update the time series metadata.
ots_client.update_timeseries_meta(request)
print("update timeseries metas succeeded.")
except Exception as e:
print("update timeseries metas failed. %s" % e)