All Products
Search
Document Center

Tablestore:Query the names of mapping tables

Last Updated:Apr 30, 2026

Run the SHOW TABLES statement to list the names of all mapping tables in your instance.

Note

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 SHOW TABLES statement or any other supported SQL statement.

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 SELECT statement. For more information, see Query data.

  • To view field names and field types of a mapping table, run the DESCRIBE statement. 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 TABLE statement. For more information, see Update attribute columns of mapping tables.

  • To remove a mapping table, run the DROP MAPPING TABLE statement. For more information, see Delete a mapping table.