Other supported statements
Besides DDL, DML, and queries, Cloudera SQL Stream Builder (SSB) supports statements that display metadata, change the current catalog, and set session properties and variables.
You can run these statements in the SQL editor of the Streaming SQL Console. Their output is displayed on the Logs tab of the results area.
| Statement | Description |
|---|---|
SHOW CATALOGS |
Lists the catalogs. |
SHOW DATABASES |
Lists the databases in the current catalog. |
SHOW TABLES |
Lists the tables in the current database. |
SHOW VIEWS |
Lists the views in the current database. |
SHOW FUNCTIONS |
Lists the functions, including built-in functions and user-defined functions. |
SHOW CURRENT CATALOG, SHOW CURRENT
DATABASE |
Displays the current catalog or database. |
DESCRIBE or DESC |
Displays the schema of a table or view. |
USE CATALOG |
Sets the current catalog. |
USE |
Sets the current database. |
SET |
Sets a session property, for example SET 'table.exec.state.ttl' = '1
h';. Run SET; alone to list the session
properties. |
RESET |
Resets a session property to its default value. Run RESET; alone
to reset all session properties. |
SET_VAR |
Sets a session variable, for example SET_VAR 'topic' =
'orders';. Run SET_VAR; alone to list the session
variables. |
RESET_VAR |
Removes a session variable. Run RESET_VAR; alone to remove all
session variables. |
SHOW and DESCRIBE statements hide passwords in their
output.
Using session variables in table options
You can use session variables in the WITH options of tables and catalogs.
Write a variable as ${name}. SSB replaces it with the
value of the variable when it runs the statement. Variable names cannot start with
ssb.env., which is reserved for environment variables. For more
information, see Managing project environments.
SET_VAR 'topic' = 'orders';
CREATE TABLE orders (
order_id STRING,
price DECIMAL(32,2)
) WITH (
'connector' = 'kafka',
'topic' = '${topic}',
'format' = 'json'
-- other connector options
);
For more information about session properties, see Configuring the session. For the Flink statements, see SHOW statements, DESCRIBE statements, USE statements, and SET statements in the Apache Flink documentation.
