更新表配置
更新時間:
Copy as MD
通過 Python SDK調用 update_table() 方法,更新資料表的生命週期、最大版本數、有效版本偏差和預留讀寫輸送量等配置。
前提條件
已初始化 Client。詳情請參見初始化Tablestore Client。
方法說明
def update_table(self, table_name, table_options=None, reserved_throughput=None)
範例程式碼
以下樣本更新 test_table 表的配置資訊。
# 配置表參數:生命週期 1 天、最大版本數 3、有效版本偏差 1 天、禁止更新
table_options = TableOptions(time_to_live=86400, max_version=3, max_time_deviation=86400, allow_update=False)
# 設定預留讀寫輸送量為 0 CU(僅 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)
相關文檔
该文章对您有帮助吗?