All Products
Search
Document Center

Tablestore:Update table configurations

Last Updated:Aug 04, 2026

Use Tablestore SDK for Python to update the TTL, version, update mode, and reserved throughput configurations of a table.

Prerequisites

Install the Tablestore SDK for Python and initialize a client.

Function description

Call the update_table method to update table configurations. You must specify at least one of table_options and reserved_throughput.

def update_table(
    self,
    table_name,
    table_options=None,
    reserved_throughput=None,
)

The following example changes the TTL of example_table to seven days and disables updates by the update_row method.

table_options = TableOptions(
    time_to_live=604800,
    max_version=1,
    max_time_deviation=86400,
    allow_update=False,
)

client.update_table(
    "example_table",
    table_options=table_options,
)

Parameters

The update_table method contains the following parameters.

Name

Type

Description

table_name (required)

str

The name of the table.

table_options (optional)

TableOptions

The table configurations to update. You must specify at least one of this parameter and reserved_throughput.

reserved_throughput (optional)

ReservedThroughput

The reserved throughput to update. You must specify at least one of this parameter and table_options.

Table configurations

The table_options parameter is of the TableOptions type and contains the following parameters.

Name

Type

Description

time_to_live (optional)

int

The TTL of data in seconds. A value of -1 indicates that data never expires. If you specify another value, the minimum value is 86400, which is one day. Expired data is automatically deleted. To use a search index or secondary index, set this parameter to -1 or set allow_update to False.

max_version (optional)

int

The maximum number of versions to retain for each attribute column. To use a search index or secondary index, set this parameter to 1.

max_time_deviation (optional)

int

The maximum version deviation in seconds. The difference between the timestamp of the data to write and the current system time must be within the maximum version deviation. The valid version range is [max(data write time - maximum version deviation, data write time - TTL), data write time + maximum version deviation).

allow_update (optional)

bool

Specifies whether data can be updated by calling update_row. If you set this parameter to False, data cannot be updated by calling update_row.

Reserved throughput

The reserved_throughput parameter is of the ReservedThroughput type and contains the following parameter.

Name

Type

Description

capacity_unit (required)

CapacityUnit

The reserved throughput in CUs. Only high-performance instances in CU mode support nonzero values.

Response

UpdateTableResponse contains the following business information.

Field

Type

Description

table_options

TableOptions

The updated table configurations.

reserved_throughput_details

ReservedThroughputDetails

The current reserved throughput and the times of the latest increase and decrease.

Examples

Update reserved throughput

The following example sets the reserved throughput of example_table to 0 CUs.

reserved_throughput = ReservedThroughput(
    CapacityUnit(read=0, write=0)
)

client.update_table(
    "example_table",
    reserved_throughput=reserved_throughput,
)