本文介紹如何通過 Python SDK 更新表的配置資訊。
前提條件
方法說明
def update_table(self, table_name, table_options=None, reserved_throughput=None)範例程式碼
以下範例程式碼用於修改test_table表的配置資訊。
# 構造資料表的配置資訊
table_options = TableOptions(time_to_live=86400, max_version=3, max_time_deviation=86400, allow_update=False)
# 設定預留讀為0CU,預留寫為0CU(僅CU模式高效能執行個體支援設定資料表的預留讀寫輸送量為非零值)
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)