Run the SHOW TABLES statement to list the names of all mapping tables in your instance.
For details about the SHOW TABLES statement, see List mapping table names.
Prerequisites
A Tablestore client is initialized. For more information, see Initialize a Tablestore client.
Usage notes
The SQL query feature requires Tablestore SDK for .NET V5.0.0 or later. For version history, see Version history of Tablestore SDK for .NET.
Parameters
|
Parameter |
Description |
|
query |
The SQL statement. Set this to the |
Example
The following example runs the SHOW TABLES statement and iterates over the result set to print each mapping table name.
/// <summary>
/// Query the names of tables in an instance.
/// </summary>
/// <param name="otsClient"></param>
public static void ShowTable(OTSClient otsClient)
{
SQLQueryRequest sqlQuery = new SQLQueryRequest("show tables");
SQLQueryResponse sqlQueryResponse = otsClient.SQLQuery(sqlQuery);
SQLTableMeta sqlTableMeta = sqlQueryResponse.GetSQLResultSet().GetSQLTableMeta();
Console.WriteLine(JsonConvert.SerializeObject(sqlTableMeta.GetSchema()));
ISQLResultSet resultSet = sqlQueryResponse.GetSQLResultSet();
while (resultSet.HasNext())
{
ISQLRow row = resultSet.Next();
Console.WriteLine(JsonConvert.SerializeObject(row.GetString(0)));
}
List<string> tables = SQLUtils.ParseShowTablesResponse(sqlQueryResponse);
foreach (string table in tables)
{
Console.WriteLine("Table: {0}", table);
}
}
References
After listing mapping table names, perform additional operations based on your needs.
To query data that meets specific conditions, run the
SELECTstatement. For more information, see Query data.To view field names and field types of a mapping table, run the
DESCRIBEstatement. For more information, see Query information about a table.To sync mapping table attribute columns after a data table attribute column changes, run the
ALTER TABLEstatement. For more information, see Update attribute columns of mapping tables.To remove a mapping table, run the
DROP MAPPING TABLEstatement. For more information, see Delete a mapping table.