SHOW Statements

SHOW statements are used to list objects within their corresponding parent, such as catalogs, databases, tables and views, columns, functions, and modules. See the individual commands for more details and additional options.

SHOW CREATE statements are used to print a DDL statement with which a given object can be created. The currently ‘SHOW CREATE’ statement is only available in printing DDL statement of the given table and view.

Flink SQL supports the following SHOW statements for now:

  • SHOW CATALOGS
  • SHOW CURRENT CATALOG
  • SHOW CREATE CATALOG
  • SHOW DATABASES
  • SHOW CURRENT DATABASE
  • SHOW TABLES
  • SHOW CREATE TABLE
  • SHOW COLUMNS
  • SHOW PARTITIONS
  • SHOW PROCEDURES
  • SHOW VIEWS
  • SHOW CREATE VIEW
  • SHOW FUNCTIONS
  • SHOW MODULES
  • SHOW JARS
  • SHOW JOBS

Run a SHOW statement

Java

SHOW statements can be executed with the executeSql() method of the TableEnvironment. The executeSql() method returns objects for a successful SHOW operation, otherwise will throw an exception.

The following examples show how to run a SHOW statement in TableEnvironment.

Scala

SHOW statements can be executed with the executeSql() method of the TableEnvironment. The executeSql() method returns objects for a successful SHOW operation, otherwise will throw an exception.

The following examples show how to run a SHOW statement in TableEnvironment.

Python

SHOW statements can be executed with the execute_sql() method of the TableEnvironment. The execute_sql() method returns objects for a successful SHOW operation, otherwise will throw an exception.

The following examples show how to run a SHOW statement in TableEnvironment.

SQL CLI

SHOW statements can be executed in SQL CLI.

The following examples show how to run a SHOW statement in SQL CLI.

Java

  1. StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
  2. StreamTableEnvironment tEnv = StreamTableEnvironment.create(env);
  3. // show catalogs
  4. tEnv.executeSql("SHOW CATALOGS").print();
  5. // +-----------------+
  6. // | catalog name |
  7. // +-----------------+
  8. // | default_catalog |
  9. // +-----------------+
  10. // show current catalog
  11. tEnv.executeSql("SHOW CURRENT CATALOG").print();
  12. // +----------------------+
  13. // | current catalog name |
  14. // +----------------------+
  15. // | default_catalog |
  16. // +----------------------+
  17. // create a catalog
  18. tEnv.executeSql("CREATE CATALOG cat2 WITH (...)");
  19. // show create catalog
  20. tEnv.executeSql("SHOW CREATE CATALOG cat2").print();
  21. // +---------------------------------------------------------------------------------------------+
  22. // | result |
  23. // +---------------------------------------------------------------------------------------------+
  24. // | CREATE CATALOG `cat2` WITH (
  25. // 'default-database' = 'db',
  26. // 'type' = 'generic_in_memory'
  27. // )
  28. // |
  29. // +---------------------------------------------------------------------------------------------+
  30. // 1 row in set
  31. // show databases
  32. tEnv.executeSql("SHOW DATABASES").print();
  33. // +------------------+
  34. // | database name |
  35. // +------------------+
  36. // | default_database |
  37. // +------------------+
  38. // show current database
  39. tEnv.executeSql("SHOW CURRENT DATABASE").print();
  40. // +-----------------------+
  41. // | current database name |
  42. // +-----------------------+
  43. // | default_database |
  44. // +-----------------------+
  45. // create a table
  46. tEnv.executeSql("CREATE TABLE my_table (...) WITH (...)");
  47. // show tables
  48. tEnv.executeSql("SHOW TABLES").print();
  49. // +------------+
  50. // | table name |
  51. // +------------+
  52. // | my_table |
  53. // +------------+
  54. // show create table
  55. tEnv.executeSql("SHOW CREATE TABLE my_table").print();
  56. // CREATE TABLE `default_catalog`.`default_db`.`my_table` (
  57. // ...
  58. // ) WITH (
  59. // ...
  60. // )
  61. // show columns
  62. tEnv.executeSql("SHOW COLUMNS FROM my_table LIKE '%f%'").print();
  63. // +--------+-------+------+-----+--------+-----------+
  64. // | name | type | null | key | extras | watermark |
  65. // +--------+-------+------+-----+--------+-----------+
  66. // | field2 | BYTES | true | | | |
  67. // +--------+-------+------+-----+--------+-----------+
  68. // create a view
  69. tEnv.executeSql("CREATE VIEW my_view AS SELECT * FROM my_table");
  70. // show views
  71. tEnv.executeSql("SHOW VIEWS").print();
  72. // +-----------+
  73. // | view name |
  74. // +-----------+
  75. // | my_view |
  76. // +-----------+
  77. // show create view
  78. tEnv.executeSql("SHOW CREATE VIEW my_view").print();
  79. // CREATE VIEW `default_catalog`.`default_db`.`my_view`(`field1`, `field2`, ...) as
  80. // SELECT *
  81. // FROM `default_catalog`.`default_database`.`my_table`
  82. // show functions
  83. tEnv.executeSql("SHOW FUNCTIONS").print();
  84. // +---------------+
  85. // | function name |
  86. // +---------------+
  87. // | mod |
  88. // | sha256 |
  89. // | ... |
  90. // +---------------+
  91. // create a user defined function
  92. tEnv.executeSql("CREATE FUNCTION f1 AS ...");
  93. // show user defined functions
  94. tEnv.executeSql("SHOW USER FUNCTIONS").print();
  95. // +---------------+
  96. // | function name |
  97. // +---------------+
  98. // | f1 |
  99. // | ... |
  100. // +---------------+
  101. // show modules
  102. tEnv.executeSql("SHOW MODULES").print();
  103. // +-------------+
  104. // | module name |
  105. // +-------------+
  106. // | core |
  107. // +-------------+
  108. // show full modules
  109. tEnv.executeSql("SHOW FULL MODULES").print();
  110. // +-------------+-------+
  111. // | module name | used |
  112. // +-------------+-------+
  113. // | core | true |
  114. // | hive | false |
  115. // +-------------+-------+

Scala

  1. val env = StreamExecutionEnvironment.getExecutionEnvironment()
  2. val tEnv = StreamTableEnvironment.create(env)
  3. // show catalogs
  4. tEnv.executeSql("SHOW CATALOGS").print()
  5. // +-----------------+
  6. // | catalog name |
  7. // +-----------------+
  8. // | default_catalog |
  9. // +-----------------+
  10. // create a catalog
  11. tEnv.executeSql("CREATE CATALOG cat2 WITH (...)")
  12. // show create catalog
  13. tEnv.executeSql("SHOW CREATE CATALOG cat2").print()
  14. // +---------------------------------------------------------------------------------------------+
  15. // | result |
  16. // +---------------------------------------------------------------------------------------------+
  17. // | CREATE CATALOG `cat2` WITH (
  18. // 'default-database' = 'db',
  19. // 'type' = 'generic_in_memory'
  20. // )
  21. // |
  22. // +---------------------------------------------------------------------------------------------+
  23. // 1 row in set
  24. // show databases
  25. tEnv.executeSql("SHOW DATABASES").print()
  26. // +------------------+
  27. // | database name |
  28. // +------------------+
  29. // | default_database |
  30. // +------------------+
  31. // create a table
  32. tEnv.executeSql("CREATE TABLE my_table (...) WITH (...)")
  33. // show tables
  34. tEnv.executeSql("SHOW TABLES").print()
  35. // +------------+
  36. // | table name |
  37. // +------------+
  38. // | my_table |
  39. // +------------+
  40. // show create table
  41. tEnv.executeSql("SHOW CREATE TABLE my_table").print()
  42. // CREATE TABLE `default_catalog`.`default_db`.`my_table` (
  43. // ...
  44. // ) WITH (
  45. // ...
  46. // )
  47. // show columns
  48. tEnv.executeSql("SHOW COLUMNS FROM my_table LIKE '%f%'").print()
  49. // +--------+-------+------+-----+--------+-----------+
  50. // | name | type | null | key | extras | watermark |
  51. // +--------+-------+------+-----+--------+-----------+
  52. // | field2 | BYTES | true | | | |
  53. // +--------+-------+------+-----+--------+-----------+
  54. // create a view
  55. tEnv.executeSql("CREATE VIEW my_view AS SELECT * FROM my_table")
  56. // show views
  57. tEnv.executeSql("SHOW VIEWS").print()
  58. // +-----------+
  59. // | view name |
  60. // +-----------+
  61. // | my_view |
  62. // +-----------+
  63. // show create view
  64. tEnv.executeSql("SHOW CREATE VIEW my_view").print();
  65. // CREATE VIEW `default_catalog`.`default_db`.`my_view`(`field1`, `field2`, ...) as
  66. // SELECT *
  67. // FROM `default_catalog`.`default_database`.`my_table`
  68. // show functions
  69. tEnv.executeSql("SHOW FUNCTIONS").print()
  70. // +---------------+
  71. // | function name |
  72. // +---------------+
  73. // | mod |
  74. // | sha256 |
  75. // | ... |
  76. // +---------------+
  77. // create a user defined function
  78. tEnv.executeSql("CREATE FUNCTION f1 AS ...")
  79. // show user defined functions
  80. tEnv.executeSql("SHOW USER FUNCTIONS").print()
  81. // +---------------+
  82. // | function name |
  83. // +---------------+
  84. // | f1 |
  85. // | ... |
  86. // +---------------+
  87. // show modules
  88. tEnv.executeSql("SHOW MODULES").print()
  89. // +-------------+
  90. // | module name |
  91. // +-------------+
  92. // | core |
  93. // +-------------+
  94. // show full modules
  95. tEnv.executeSql("SHOW FULL MODULES").print()
  96. // +-------------+-------+
  97. // | module name | used |
  98. // +-------------+-------+
  99. // | core | true |
  100. // | hive | false |
  101. // +-------------+-------+

Python

  1. table_env = StreamTableEnvironment.create(...)
  2. # show catalogs
  3. table_env.execute_sql("SHOW CATALOGS").print()
  4. # +-----------------+
  5. # | catalog name |
  6. # +-----------------+
  7. # | default_catalog |
  8. # +-----------------+
  9. # create a catalog
  10. table_env.execute_sql("CREATE CATALOG cat2 WITH (...)")
  11. # show create catalog
  12. table_env.execute_sql("SHOW CREATE CATALOG cat2").print()
  13. # +---------------------------------------------------------------------------------------------+
  14. # | result |
  15. # +---------------------------------------------------------------------------------------------+
  16. # | CREATE CATALOG `cat2` WITH (
  17. # 'default-database' = 'db',
  18. # 'type' = 'generic_in_memory'
  19. # )
  20. # |
  21. # +---------------------------------------------------------------------------------------------+
  22. # 1 row in set
  23. # show databases
  24. table_env.execute_sql("SHOW DATABASES").print()
  25. # +------------------+
  26. # | database name |
  27. # +------------------+
  28. # | default_database |
  29. # +------------------+
  30. # create a table
  31. table_env.execute_sql("CREATE TABLE my_table (...) WITH (...)")
  32. # show tables
  33. table_env.execute_sql("SHOW TABLES").print()
  34. # +------------+
  35. # | table name |
  36. # +------------+
  37. # | my_table |
  38. # +------------+
  39. # show create table
  40. table_env.executeSql("SHOW CREATE TABLE my_table").print()
  41. # CREATE TABLE `default_catalog`.`default_db`.`my_table` (
  42. # ...
  43. # ) WITH (
  44. # ...
  45. # )
  46. # show columns
  47. table_env.execute_sql("SHOW COLUMNS FROM my_table LIKE '%f%'").print()
  48. # +--------+-------+------+-----+--------+-----------+
  49. # | name | type | null | key | extras | watermark |
  50. # +--------+-------+------+-----+--------+-----------+
  51. # | field2 | BYTES | true | | | |
  52. # +--------+-------+------+-----+--------+-----------+
  53. # create a view
  54. table_env.execute_sql("CREATE VIEW my_view AS SELECT * FROM my_table")
  55. # show views
  56. table_env.execute_sql("SHOW VIEWS").print()
  57. # +-----------+
  58. # | view name |
  59. # +-----------+
  60. # | my_view |
  61. # +-----------+
  62. # show create view
  63. table_env.execute_sql("SHOW CREATE VIEW my_view").print()
  64. # CREATE VIEW `default_catalog`.`default_db`.`my_view`(`field1`, `field2`, ...) as
  65. # SELECT *
  66. # FROM `default_catalog`.`default_database`.`my_table`
  67. # show functions
  68. table_env.execute_sql("SHOW FUNCTIONS").print()
  69. # +---------------+
  70. # | function name |
  71. # +---------------+
  72. # | mod |
  73. # | sha256 |
  74. # | ... |
  75. # +---------------+
  76. # create a user defined function
  77. table_env.execute_sql("CREATE FUNCTION f1 AS ...")
  78. # show user defined functions
  79. table_env.execute_sql("SHOW USER FUNCTIONS").print()
  80. # +---------------+
  81. # | function name |
  82. # +---------------+
  83. # | f1 |
  84. # | ... |
  85. # +---------------+
  86. # show modules
  87. table_env.execute_sql("SHOW MODULES").print()
  88. # +-------------+
  89. # | module name |
  90. # +-------------+
  91. # | core |
  92. # +-------------+
  93. # show full modules
  94. table_env.execute_sql("SHOW FULL MODULES").print()
  95. # +-------------+-------+
  96. # | module name | used |
  97. # +-------------+-------+
  98. # | core | true |
  99. # | hive | false |
  100. # +-------------+-------+

SQL CLI

  1. Flink SQL> SHOW CATALOGS;
  2. default_catalog
  3. Flink SQL> CREATE CATALOG cat2 WITH (...);
  4. [INFO] Execute statement succeeded.
  5. Flink SQL> SHOW CREATE CATALOG cat2;
  6. CREATE CATALOG `cat2` WITH (
  7. ...
  8. )
  9. Flink SQL> SHOW DATABASES;
  10. default_database
  11. Flink SQL> CREATE TABLE my_table (...) WITH (...);
  12. [INFO] Table has been created.
  13. Flink SQL> SHOW TABLES;
  14. my_table
  15. Flink SQL> SHOW CREATE TABLE my_table;
  16. CREATE TABLE `default_catalog`.`default_db`.`my_table` (
  17. ...
  18. ) WITH (
  19. ...
  20. )
  21. Flink SQL> SHOW COLUMNS from MyUserTable LIKE '%f%';
  22. +--------+-------+------+-----+--------+-----------+
  23. | name | type | null | key | extras | watermark |
  24. +--------+-------+------+-----+--------+-----------+
  25. | field2 | BYTES | true | | | |
  26. +--------+-------+------+-----+--------+-----------+
  27. 1 row in set
  28. Flink SQL> CREATE VIEW my_view AS SELECT * from my_table;
  29. [INFO] View has been created.
  30. Flink SQL> SHOW VIEWS;
  31. my_view
  32. Flink SQL> SHOW CREATE VIEW my_view;
  33. CREATE VIEW `default_catalog`.`default_db`.`my_view`(`field1`, `field2`, ...) as
  34. SELECT *
  35. FROM `default_catalog`.`default_database`.`my_table`
  36. Flink SQL> SHOW FUNCTIONS;
  37. mod
  38. sha256
  39. ...
  40. Flink SQL> CREATE FUNCTION f1 AS ...;
  41. [INFO] Function has been created.
  42. Flink SQL> SHOW USER FUNCTIONS;
  43. f1
  44. ...
  45. Flink SQL> SHOW MODULES;
  46. +-------------+
  47. | module name |
  48. +-------------+
  49. | core |
  50. +-------------+
  51. 1 row in set
  52. Flink SQL> SHOW FULL MODULES;
  53. +-------------+------+
  54. | module name | used |
  55. +-------------+------+
  56. | core | true |
  57. +-------------+------+
  58. 1 row in set
  59. Flink SQL> SHOW JARS;
  60. /path/to/addedJar.jar

SHOW CATALOGS

  1. SHOW CATALOGS

Show all catalogs.

SHOW CURRENT CATALOG

  1. SHOW CURRENT CATALOG

Show current catalog.

SHOW CREATE CATALOG

  1. SHOW CREATE CATALOG catalog_name

Show creation statement for an existing catalog.

The output includes the catalog’s name and relevant properties, which allows you to gain an intuitive understanding of the underlying catalog’s metadata.

Assumes that the catalog cat2 is created as follows:

  1. create catalog cat2 WITH (
  2. 'type'='generic_in_memory',
  3. 'default-database'='db'
  4. );

Shows the creation statement.

  1. show create catalog cat2;
  2. +---------------------------------------------------------------------------------------------+
  3. | result |
  4. +---------------------------------------------------------------------------------------------+
  5. | CREATE CATALOG `cat2` WITH (
  6. 'default-database' = 'db',
  7. 'type' = 'generic_in_memory'
  8. )
  9. |
  10. +---------------------------------------------------------------------------------------------+
  11. 1 row in set

SHOW DATABASES

  1. SHOW DATABASES [ ( FROM | IN ) catalog_name] [ [NOT] (LIKE | ILIKE) <sql_like_pattern> ]

Show all databases within optionally specified catalog. If no catalog is specified, then the default catalog is used. Additionally, a <sql_like_pattern> can be used to filter the databases.

LIKE Show all databases with a LIKE clause, whose name is similar to the <sql_like_pattern>.

The syntax of the SQL pattern in the LIKE clause is the same as that of the MySQL dialect.

  • % matches any number of characters, even zero characters, and \% matches one % character.
  • _ matches exactly one character, \_ matches one _ character.

ILIKE The same behavior as LIKE but the SQL pattern is case-insensitive.

SHOW CURRENT DATABASE

  1. SHOW CURRENT DATABASE

Show current database.

SHOW TABLES

  1. SHOW TABLES [ ( FROM | IN ) [catalog_name.]database_name ] [ [NOT] LIKE <sql_like_pattern> ]

Show all tables for an optionally specified database. If no database is specified then the tables are returned from the current database. Additionally, the output of this statement may be filtered by an optional matching pattern.

LIKE Show all tables with given table name and optional LIKE clause, whose name is whether similar to the <sql_like_pattern>.

The syntax of sql pattern in LIKE clause is the same as that of MySQL dialect.

  • % matches any number of characters, even zero characters, \% matches one % character.
  • _ matches exactly one character, \_ matches one _ character.

SHOW TABLES EXAMPLES

Assumes that the db1 database located in catalog1 catalog has the following tables:

  • person
  • dim

the current database in session has the following tables:

  • items
  • orders

  • Shows all tables of the given database.

  1. show tables from db1;
  2. -- show tables from catalog1.db1;
  3. -- show tables in db1;
  4. -- show tables in catalog1.db1;
  5. +------------+
  6. | table name |
  7. +------------+
  8. | dim |
  9. | person |
  10. +------------+
  11. 2 rows in set
  • Shows all tables of the given database, which are similar to the given sql pattern.
  1. show tables from db1 like '%n';
  2. -- show tables from catalog1.db1 like '%n';
  3. -- show tables in db1 like '%n';
  4. -- show tables in catalog1.db1 like '%n';
  5. +------------+
  6. | table name |
  7. +------------+
  8. | person |
  9. +------------+
  10. 1 row in set
  • Shows all tables of the given database, which are not similar to the given sql pattern.
  1. show tables from db1 not like '%n';
  2. -- show tables from catalog1.db1 not like '%n';
  3. -- show tables in db1 not like '%n';
  4. -- show tables in catalog1.db1 not like '%n';
  5. +------------+
  6. | table name |
  7. +------------+
  8. | dim |
  9. +------------+
  10. 1 row in set
  • Shows all tables of the current database.
  1. show tables;
  2. +------------+
  3. | table name |
  4. +------------+
  5. | items |
  6. | orders |
  7. +------------+
  8. 2 rows in set

SHOW CREATE TABLE

  1. SHOW CREATE TABLE [[catalog_name.]db_name.]table_name

Show create table statement for specified table.

The output includes the table name, column names, data types, constraints, comments, and configurations.

It is a very useful statement when you need to understand the structure, configuration and constraints of an existing table or to recreate the table in another database.

Assumes that the table orders is created as follows:

  1. CREATE TABLE orders (
  2. order_id BIGINT NOT NULL comment 'this is the primary key, named ''order_id''.',
  3. product VARCHAR(32),
  4. amount INT,
  5. ts TIMESTAMP(3) comment 'notice: watermark, named ''ts''.',
  6. ptime AS PROCTIME() comment 'notice: computed column, named ''ptime''.',
  7. WATERMARK FOR ts AS ts - INTERVAL '1' SECOND,
  8. CONSTRAINT `PK_order_id` PRIMARY KEY (order_id) NOT ENFORCED
  9. ) WITH (
  10. 'connector' = 'datagen'
  11. );

Shows the creation statement.

  1. show create table orders;
  2. +---------------------------------------------------------------------------------------------+
  3. | result |
  4. +---------------------------------------------------------------------------------------------+
  5. | CREATE TABLE `default_catalog`.`default_database`.`orders` (
  6. `order_id` BIGINT NOT NULL COMMENT 'this is the primary key, named ''order_id''.',
  7. `product` VARCHAR(32),
  8. `amount` INT,
  9. `ts` TIMESTAMP(3) COMMENT 'notice: watermark, named ''ts''.',
  10. `ptime` AS PROCTIME() COMMENT 'notice: computed column, named ''ptime''.',
  11. WATERMARK FOR `ts` AS `ts` - INTERVAL '1' SECOND,
  12. CONSTRAINT `PK_order_id` PRIMARY KEY (`order_id`) NOT ENFORCED
  13. ) WITH (
  14. 'connector' = 'datagen'
  15. )
  16. |
  17. +---------------------------------------------------------------------------------------------+
  18. 1 row in set

Attention Currently SHOW CREATE TABLE only supports table that is created by Flink SQL DDL.

SHOW COLUMNS

  1. SHOW COLUMNS ( FROM | IN ) [[catalog_name.]database.]<table_name> [ [NOT] LIKE <sql_like_pattern>]

Show all columns of the table with given table name and optional like clause.

LIKE Show all columns of the table with given table name and optional LIKE clause, whose name is whether similar to the <sql_like_pattern>.

The syntax of sql pattern in LIKE clause is the same as that of MySQL dialect.

SHOW COLUMNS EXAMPLES

Assumes that the table named orders in the database1 database which is located in the catalog1 catalog has the following structure:

  1. +---------+-----------------------------+-------+-----------+---------------+----------------------------+
  2. | name | type | null | key | extras | watermark |
  3. +---------+-----------------------------+-------+-----------+---------------+----------------------------+
  4. | user | BIGINT | false | PRI(user) | | |
  5. | product | VARCHAR(32) | true | | | |
  6. | amount | INT | true | | | |
  7. | ts | TIMESTAMP(3) *ROWTIME* | true | | | `ts` - INTERVAL '1' SECOND |
  8. | ptime | TIMESTAMP_LTZ(3) *PROCTIME* | false | | AS PROCTIME() | |
  9. +---------+-----------------------------+-------+-----------+---------------+----------------------------+
  • Shows all columns of the given table.
  1. show columns from orders;
  2. -- show columns from database1.orders;
  3. -- show columns from catalog1.database1.orders;
  4. -- show columns in orders;
  5. -- show columns in database1.orders;
  6. -- show columns in catalog1.database1.orders;
  7. +---------+-----------------------------+-------+-----------+---------------+----------------------------+
  8. | name | type | null | key | extras | watermark |
  9. +---------+-----------------------------+-------+-----------+---------------+----------------------------+
  10. | user | BIGINT | false | PRI(user) | | |
  11. | product | VARCHAR(32) | true | | | |
  12. | amount | INT | true | | | |
  13. | ts | TIMESTAMP(3) *ROWTIME* | true | | | `ts` - INTERVAL '1' SECOND |
  14. | ptime | TIMESTAMP_LTZ(3) *PROCTIME* | false | | AS PROCTIME() | |
  15. +---------+-----------------------------+-------+-----------+---------------+----------------------------+
  16. 5 rows in set
  • Shows all columns of the given table, which are similar to the given sql pattern.
  1. show columns from orders like '%r';
  2. -- show columns from database1.orders like '%r';
  3. -- show columns from catalog1.database1.orders like '%r';
  4. -- show columns in orders like '%r';
  5. -- show columns in database1.orders like '%r';
  6. -- show columns in catalog1.database1.orders like '%r';
  7. +------+--------+-------+-----------+--------+-----------+
  8. | name | type | null | key | extras | watermark |
  9. +------+--------+-------+-----------+--------+-----------+
  10. | user | BIGINT | false | PRI(user) | | |
  11. +------+--------+-------+-----------+--------+-----------+
  12. 1 row in set
  • Shows all columns of the given table, which are not similar to the given sql pattern.
  1. show columns from orders not like '%_r';
  2. -- show columns from database1.orders not like '%_r';
  3. -- show columns from catalog1.database1.orders not like '%_r';
  4. -- show columns in orders not like '%_r';
  5. -- show columns in database1.orders not like '%_r';
  6. -- show columns in catalog1.database1.orders not like '%_r';
  7. +---------+-----------------------------+-------+-----+---------------+----------------------------+
  8. | name | type | null | key | extras | watermark |
  9. +---------+-----------------------------+-------+-----+---------------+----------------------------+
  10. | product | VARCHAR(32) | true | | | |
  11. | amount | INT | true | | | |
  12. | ts | TIMESTAMP(3) *ROWTIME* | true | | | `ts` - INTERVAL '1' SECOND |
  13. | ptime | TIMESTAMP_LTZ(3) *PROCTIME* | false | | AS PROCTIME() | |
  14. +---------+-----------------------------+-------+-----+---------------+----------------------------+
  15. 4 rows in set

SHOW PARTITIONS

  1. SHOW PARTITIONS [[catalog_name.]database.]<table_name> [ PARTITION <partition_spec>]
  2. <partition_spec>:
  3. (key1=val1, key2=val2, ...)

Show all partitions of the partitioned table with the given table name and optional partition clause.

PARTITION Show all the partitions which are under the provided <partition_spec> in the given table.

SHOW PARTITIONS EXAMPLES

Assumes that the partitioned table table1 in the database1 database which is located in the catalog1 catalog has the following partitions:

  1. +---------+-----------------------------+
  2. | id | date |
  3. +---------+-----------------------------+
  4. | 1001 | 2020-01-01 |
  5. | 1002 | 2020-01-01 |
  6. | 1002 | 2020-01-02 |
  7. +---------+-----------------------------+
  • Shows all partitions of the given table.
  1. show partitions table1;
  2. -- show partitions database1.table1;
  3. -- show partitions catalog1.database1.table1;
  4. +---------+-----------------------------+
  5. | id | date |
  6. +---------+-----------------------------+
  7. | 1001 | 2020-01-01 |
  8. | 1002 | 2020-01-01 |
  9. | 1002 | 2020-01-02 |
  10. +---------+-----------------------------+
  11. 3 rows in set
  • Shows all partitions of the given table with the given partition spec.
  1. show partitions table1 partition (id=1002);
  2. -- show partitions database1.table1 partition (id=1002);
  3. -- show partitions catalog1.database1.table1 partition (id=1002);
  4. +---------+-----------------------------+
  5. | id | date |
  6. +---------+-----------------------------+
  7. | 1002 | 2020-01-01 |
  8. | 1002 | 2020-01-02 |
  9. +---------+-----------------------------+
  10. 2 rows in set

SHOW PROCEDURES

  1. SHOW PROCEDURES [ ( FROM | IN ) [catalog_name.]database_name ] [ [NOT] (LIKE | ILIKE) <sql_like_pattern> ]

Show all procedures for an optionally specified database. If no database is specified then the procedures are returned from the current database. Additionally, a <sql_like_pattern> can be used to filter the procedures.

LIKE Show all procedures with a LIKE clause, whose name is similar to the <sql_like_pattern>.

The syntax of the SQL pattern in the LIKE clause is the same as that of the MySQL dialect.

  • % matches any number of characters, even zero characters, and \% matches one % character.
  • _ matches exactly one character, \_ matches one _ character.

ILIKE The same behavior as LIKE but the SQL pattern is case-insensitive.

SHOW VIEWS

  1. SHOW VIEWS

Show all views in the current catalog and the current database.

SHOW CREATE VIEW

  1. SHOW CREATE VIEW [catalog_name.][db_name.]view_name

Show create view statement for specified view.

SHOW FUNCTIONS

  1. SHOW [USER] FUNCTIONS [ ( FROM | IN ) [catalog_name.]database_name ] [ [NOT] (LIKE | ILIKE) <sql_like_pattern> ]

Show all functions including system functions and user-defined functions for an optionally specified database. If no database is specified then the functions are returned from the current database. Additionally, a <sql_like_pattern> can be used to filter the functions.

USER Show only user-defined functions for an optionally specified database. If no database is specified then the functions are returned from the current database. Additionally, a <sql_like_pattern> can be used to filter the functions.

LIKE Show all functions with a LIKE clause, whose name is similar to the <sql_like_pattern>.

The syntax of the SQL pattern in the LIKE clause is the same as that of the MySQL dialect.

  • % matches any number of characters, even zero characters, and \% matches one % character.
  • _ matches exactly one character, \_ matches one _ character.

ILIKE The same behavior as LIKE but the SQL pattern is case-insensitive.

SHOW MODULES

  1. SHOW [FULL] MODULES

Show all enabled module names with resolution order.

FULL Show all loaded modules and enabled status with resolution order.

SHOW JARS

  1. SHOW JARS

Show all added jars in the session classloader which are added by ADD JAR statements.

Attention Currently SHOW JARS statements only work in the SQL CLI or SQL Gateway.

SHOW JOBS

  1. SHOW JOBS

Show the jobs in the Flink cluster.

Attention Currently SHOW JOBS statements only work in the SQL CLI or SQL Gateway.