All Products
Search
Document Center

Tablestore:Query the names of tables

Last Updated:Nov 03, 2023

You can execute the SHOW TABLES statement to query the names of tables in the current database.

Note For more information about the show tables statement, see List table names.

Prerequisites

Parameters

Parameter

Description

query

The SQL statement. Specify the parameter based on the required feature.

Example

Execute the show tables statement to list the names of tables.

def show_tables(client):
    query = 'show tables'
    rowlist, _, _ = client.exe_sql_query(query)
    ret = []
    for row in rowlist:
        ret.append(row.attribute_columns)
    print(ret)

The following output is returned:

Note

The instance_name parameter in the response indicates the name of the Tablestore instance. The actual value returned prevails.

[[('Tables_in_instance_name', 'exampletable')], 
[('Tables_in_instance_name', 'test_table')]]