使用DescribeTable接口可以查询指定表的结构、预留读/写吞吐量详情等信息。
说明 API说明请参见DescribeTable。
前提条件
- 已初始化Client。具体操作,请参见初始化。
- 已创建数据表。
参数
参数 | 说明 |
---|---|
tableName | 表名。 |
示例
private static void describeTable(SyncClient client) {
DescribeTableRequest request = new DescribeTableRequest(TABLE_NAME);
DescribeTableResponse response = client.describeTable(request);
TableMeta tableMeta = response.getTableMeta();
System.out.println("表的名称:" + tableMeta.getTableName());
System.out.println("表的主键:");
for (PrimaryKeySchema primaryKeySchema : tableMeta.getPrimaryKeyList()) {
System.out.println(primaryKeySchema);
}
TableOptions tableOptions = response.getTableOptions();
System.out.println("表的TTL:" + tableOptions.getTimeToLive());
System.out.println("表的MaxVersions:" + tableOptions.getMaxVersions());
ReservedThroughputDetails reservedThroughputDetails = response.getReservedThroughputDetails();
System.out.println("表的预留读吞吐量:"
+ reservedThroughputDetails.getCapacityUnit().getReadCapacityUnit());
System.out.println("表的预留写吞吐量:"
+ reservedThroughputDetails.getCapacityUnit().getWriteCapacityUnit());
}