Use o Tablestore SDK for Python para atualizar configurações da tabela, como tempo de vida (TTL), versão máxima e throughput reservado.
Pré-requisitos
Antes de começar, verifique se você tem:
Um cliente inicializado. Para mais informações, consulte Inicializar um cliente do Tablestore.
Descrição do método
def update_table(self, table_name, table_options=None, reserved_throughput=None)
Código de exemplo
O exemplo a seguir atualiza as configurações da tabela 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)