All Products
Search
Document Center

:SHOW

Last Updated:Aug 24, 2022

Queries the metadata of a specified object in the ApsaraDB for Linform time series engine.

Syntax

show_statement  ::= SHOW target_statement  
target_statement ::= { DATABASES | TABLES | USERS | PRIVILEGES }
Note

  1. The following objects are supported by the SHOW statement:

    • DATABASES: query all databases in the current ApsaraDB for Lindorm cluster.

    • TABLES: query all time series tables in the current ApsaraDB for Lindorm cluster.

    • USERS: query all users of the current ApsaraDB for Lindorm cluster.

    • PRIVILEGES: query the permissions of the users of the current ApsaraDB for Lindorm cluster.

  2. The permissions that are required to execute the SHOW statement varies based on the object that is specified in the statement. For more information, see Permissions that are required for executing common SQL statements.

Result sets

The result sets of SHOW statements are organized in tables and returned. The following table describes the result sets of SHOW statements that are executed to query different objects.

SHOW DATABASES

Column name

Type

Description

database

VARCHAR

This column stores the names of all databases in the current ApsaraDB for Lindorm cluster.

SHOW TABLES

Column name

Type

Description

Tables_In_${Database name}

VARCHAR

This column stores the names of all tables in the current database.

If you want to query the tables in other databases, execute the USE statement to switch to the database that you want to query.

SHOW USERS

Column name

Type

Description

name

VARCHAR

This column stores the names of all users of the current ApsaraDB for Lindorm cluster.

SHOW PRIVILEGES

Column name

Type

Description

user

VARCHAR

This column stores the names of the users that have full permissions.

global privileges

VARCHAR

This column stores the names of the users that have global permissions.

database privileges

VARCHAR

This column stores the names of the users that have database-level permissions.

table privileges

VARCHAR

This column stores the names of the users that have table-level permissions.

Note

  1. The data in the permission columns is displayed in JSON format. This way, applications can directly process the data. JSON data is stored as key-value pairs.

    • key: the name of the object that is queried, such as a database name or table name. The key for global permissions is fixed to GLOBAL.

    • value: the list of permissions. The Example section shows the details.

    If the queried users do not have the permissions of the specified level, an empty JSON string is returned.

  2. The ApsaraDB for Lindorm time series engine does not support table-level permission control.

Examples

The following example shows how to query all databases in the current ApsaraDB for Lindorm cluster:

> SHOW DATABASES;
+----------+
| database |
+----------+
| default  |
| metadata |
+----------+
2 rows in set (13 ms)

The following example shows how to query all time series tables in the current ApsaraDB for Lindorm cluster:

> SHOW TABLES;
+-------------+------------+
| tableSchem  | tableName  |
+-------------+------------+
| default     | sensor     |
| metadata    | COLUMNS    |
| metadata    | TABLES     |
+-------------+------------+
3 rows selected (0.064 seconds)

The following example shows how to query all users of the current ApsaraDB for Lindorm cluster:

> SHOW USERS;
+-----------+
|   name    |
+-----------+
| testuser  |
| dbwriter  |
| root      |
+-----------+
3 rows in set (11 ms)

The following example shows how to query the permissions of the users of the current ApsaraDB for Lindorm cluster:

> SHOW PRIVILEGES;
+------------+-------------------------------------+--------------------------------------+------------------+
|    user    |          global privileges          |         database privileges          | table privileges |
+------------+-------------------------------------+--------------------------------------+------------------+
| testuser   | {"GLOBAL":["READ"]}                 | {}                                   | {}               |
| dbaccessor | {"GLOBAL":["ADMIN","READ","WRITE"]} | {"DB2":["READ"],"default":["WRITE"]} | {}               |
+------------+-------------------------------------+--------------------------------------+------------------+