All Products
Search
Document Center

Realtime Compute for Apache Flink:Scripts

Last Updated:Sep 12, 2024

A script can contain the CALL command and DDL, DQL, and DML statements. You can use scripts to create and manage catalogs and tables, perform data queries, and manage Apache Paimon tables. You can use the Explain statement in a script to view execution plans and troubleshoot issues.

Features

脚本查询.png

  • The syntax of the SQL statements in a script can be verified. If the verification fails, the script cannot be run.

  • You can execute specific or all statements in a script.

  • A script can contain the CALL command and DDL, DQL, and DML statements.

    Important

    If DDL or DML statements are executed in a script, online metadata or data is affected. Proceed with caution.

  • The code that you write is automatically saved every minute. You can also manually save the temporary script in the SQL Console folder.

Procedure

  1. Log on to the Realtime Compute for Apache Flink console.

  2. find the workspace that you want to manage and click Console in the Actions column.

  3. In the left-side navigation pane, click Development > Scripts. On the SQL Editor page, click the Scripts tab.

  4. In the upper-left corner of the Scripts tab, click the image.png icon to create a script.

  5. Enter the SQL code in the SQL editor.

    A script can contain the CALL command and DDL, DQL, and DML statements. By default, the batch mode is used. You can execute the following SET statement to change the script execution mode to the streaming mode:

    Note

    You cannot use deployment variables and keys for a script. For more information about deployment variables and keys, see Manage keys.

    SET 'execution.runtime-mode' = 'streaming';
  6. Select or create a session cluster.

    In the lower-right corner of the script editing page, select a session cluster from the Environment drop-down list. You can select a session cluster that uses Ververica Runtime (VVR) 8.0.4 or later. If no session cluster exists, create a session cluster. For more information, see Step 1: Create a session cluster.

  7. Select the code that you want to run and click Run that appears to the left of the code.

  8. (Optional) In the upper-right corner of the script editing page, click Save. In the Save Script dialog box, configure the Name and Location parameters.

References