Use the Tablestore SDK for Python to update table configurations such as time to live (TTL), max version, and reserved throughput.
Prerequisites
Before you begin, ensure that you have:
An initialized client. For more information, see Initialize a Tablestore client.
Method description
def update_table(self, table_name, table_options=None, reserved_throughput=None)
Sample code
The following example updates the configurations of test_table.
# Set table configurations: TTL of 1 day, max 3 versions, max time deviation of 1 day, updates disabled
table_options = TableOptions(time_to_live=86400, max_version=3, max_time_deviation=86400, allow_update=False)
# Set reserved read and write throughput to 0 CUs
# Non-zero values are only supported for high-performance instances in CU mode
reserved_throughput = ReservedThroughput(CapacityUnit(0, 0))
try:
client.update_table('test_table', table_options, reserved_throughput)
print("Update table succeeded.")
except Exception as e:
print("Update table failed. %s" % e)