使用 Python SDK 查詢資料表的表結構、表配置、加密、預留讀寫輸送量和二級索引資訊。
前提條件
安裝Tablestore Python SDK並初始化用戶端。
功能說明
調用 describe_table 方法查詢指定資料表,返回包含當前表資訊的 DescribeTableResponse。
def describe_table(self, table_name)
以下樣本查詢 example_table 並輸出主要返回資訊。
response = client.describe_table("example_table")
print("Table metadata:", response.table_meta)
print("Table options:", response.table_options)
print("Encryption settings:", response.sse_details)
print(
"Reserved throughput:",
response.reserved_throughput_details,
)
print("Secondary indexes:", response.secondary_indexes)
參數說明
describe_table 方法包含以下參數。
|
名稱 |
類型 |
說明 |
|
table_name(必選) |
|
資料表名稱。 |
傳回值
DescribeTableResponse 包含以下商務資訊。
|
欄位 |
類型 |
說明 |
|
table_meta |
|
資料表結構,包括資料表名稱、主鍵列和預定義列。 |
|
table_options |
|
表配置,包括資料生命週期、最大版本數、有效版本偏差和是否允許更新。 |
|
reserved_throughput_details |
|
當前預留讀寫輸送量,以及最近一次上調和下調的時間。 |
|
secondary_indexes |
|
二級索引資訊,包括索引名稱、主鍵列、預定義列和索引類型。 |
|
sse_details |
|
服務端加密配置,包括啟用狀態、密鑰類型、金鑰識別碼 和 RAM 角色 ARN。 |