Tablestore SDK for Python を使用して、生存時間 (TTL)、最大バージョン数、予約スループットなどのテーブル構成を更新します。
前提条件
作業を開始する前に、次の要件を満たしていることを確認してください。
初期化済みのクライアント。詳細については、「Tablestore クライアントの初期化」をご参照ください。
メソッドの説明
def update_table(self, table_name, table_options=None, reserved_throughput=None)
サンプルコード
次の例では、test_table の構成を更新します。
# テーブル構成を設定:TTL 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)