Time series table operations

更新时间: 2026-06-08 15:27:16

Create, list, select, describe, update, and drop TimeSeries model with the CLI.

Prerequisites

  • An installed CLI with configured access credentials. For more information, see Tablestore CLI.

  • A Tablestore instance. For more information, see Instance operations.

Create a time series table

Create a time series table with an optional time-to-live (TTL) setting.

create -m timeseries -t <tableName> --ttl <timeToLive>

Parameter

Required

Description

-m, --model

Yes

The table type. Set this parameter to timeseries to create a time series table.

-t, --table

Yes

The name of the time series table.

--ttl

No

The TTL of data in the time series table, in seconds. Default value: -1 (data never expires). Valid values: an integer greater than or equal to 86400 (one day), or -1.

Important

Data expiration is calculated from the timestamp column that you specify, not from the write time.

Example

Create a time series table named mytable where data never expires.

create -m timeseries -t mytable --ttl -1

List time series tables

List all time series tables in the current instance.

list_table --ts

Select a time series table

Select a time series table for subsequent data operations.

use --ts -t <tableName>

Parameter

Required

Description

--ts

Yes

Operates on a time series table.

-t, --table

Yes

The name of the time series table.

Example

use --ts -t mytable

Describe a time series table

View the configuration of a time series table.

desc --ts -t <tableName>

Parameter

Required

Description

--ts

No

Operates on a time series table. Optional if a time series table is already selected with use --ts.

-t, --table

No

The name of the time series table. Optional if a table is already selected with use.

-f, --print_format

No

The output format. Valid values: json (default) and table.

-o, --output

No

Saves the table information to a local JSON file.

Example

desc --ts -t mytable

Update a time series table

Update the TTL of a time series table.

alter --ttl <timeToLive> --ts

Parameter

Required

Description

--ts

Yes

Operates on a time series table.

--ttl

Yes

The TTL of data in the time series table, in seconds. Valid values: an integer greater than or equal to 86400 (one day), or -1 (data never expires).

Important

Data expiration is calculated from the timestamp column that you specify, not from the write time.

Example

Set the TTL of the current time series table to 86400 seconds (one day).

alter --ttl 86400 --ts

Drop a time series table

Drop a time series table and all its data.

drop -t <tableName> --ts -y

Parameter

Required

Description

-t, --table

Yes

The name of the time series table.

--ts

Yes

Operates on a time series table.

-y, --yes

Yes

Skips the deletion confirmation prompt.

Example

Drop the mytable time series table.

drop -t mytable --ts -y
上一篇: TimeSeries model 下一篇: Data operations
阿里云首页 表格存储 相关技术圈