You can call the DescribeTable operation to query the description of a table, such as the schema information, reserved read throughput, and reserved write throughput.
Prerequisites
A Tablestore client is initialized. For more information, see Initialize an OTSClient instance.
A data table is created. For more information, see Create a data table.
API operation
/// <summary>
/// Query the schema information, the reserved read throughput, and the reserved write throughput of a table.
/// </summary>
/// <param name="request">Request parameters, including the table name.</param>
/// <returns>The schema information, the reserved read throughput, and the reserved write throughput of the table. </returns>
public DescribeTableResponse DescribeTable(DescribeTableRequest request);
/// <summary>
/// The asynchronous mode of DescribeTable.
/// </summary>
public Task<DescribeTableResponse> DescribeTableAsync(DescribeTableRequest request);
Parameters
Parameter | Description |
tableName | The name of the table |
Examples
The following sample code provides an example on how to query the description of a table:
try
{
var request = new DescribeTableRequest("SampleTable");
var response = otsClient.DescribeTable(request);
// Display the description of the table.
Console.WriteLine("Describe table succeeded.");
Console.WriteLine("LastIncreaseTime: {0}", response.ReservedThroughputDetails.LastIncreaseTime);
Console.WriteLine("LastDecreaseTime: {0}", response.ReservedThroughputDetails.LastDecreaseTime);
Console.WriteLine("NumberOfDecreaseToday: {0}", response.ReservedThroughputDetails.LastIncreaseTime);
Console.WriteLine("ReadCapacity: {0}", response.ReservedThroughputDetails.CapacityUnit.Read);
Console.WriteLine("WriteCapacity: {0}", response.ReservedThroughputDetails.CapacityUnit.Write);
}
catch (Exception ex)
{
// If the operation fails, an exception is returned. Handle the exception.
Console.WriteLine("Describe table failed, exception:{0}", ex.Message);
}
References
For information about the API operation that you can call to query the description of a table, see DescribeTable.
You can call API operations to read and write data in a data table. For more information, see Basic operations on data.
You can update a table to modify the information about the table, such as the TTL and max versions. For more information, see UpdateTable.
You can delete a data table that you no longer require. For more information, see Delete a data table.