All Products
Search
Document Center

Tablestore:Delete time series

Last Updated:Apr 11, 2025

You can call the DeleteTimeseriesMeta operation to batch delete time series metadata in a batch.

Prerequisites

A Tablestore client is initialized. For more information, see Initialize Tablestore client.

Parameters

The following table describes the parameters included in request.

Parameter

Description

timeseries_tablename (required)

The name of the time series table.

keys (required)

The list of time series identifiers. This parameter includes the following configuration items:

  • measurement_name (required): the measure name of the time series.

  • data_source (required): the data source information.

  • tags (required): the tag information of the time series, which consists of multiple key-value pairs.

Examples

The following sample code provides an example on how to delete a specific time series from a time series table.

# The tag information of the time series.
tags = {"tag1": "t1", "tag2": "t2"}
# The time series identifiers.
key = TimeseriesKey("measure", "datasource", tags)

try:
    request = DeleteTimeseriesMetaRequest("time_table_test", [key])

    # Call the operation to delete time series metadata.
    ots_client.delete_timeseries_meta(request)
    print("delete timeseries metas succeeded.")
except Exception as e:
    # If an exception is thrown, the deletion fails. Handle the exception.
    print("delete timeseries metas failed. %s" % e)