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
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.
ImportantIf 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
Log on to the Realtime Compute for Apache Flink console.
find the workspace that you want to manage and click Console in the Actions column.
In the left-side navigation pane, click
. On the SQL Editor page, click the Scripts tab.In the upper-left corner of the Scripts tab, click the icon to create a script.
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:
NoteYou 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';
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.
Select the code that you want to run and click Run that appears to the left of the code.
(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
For more information about how to create a session cluster, see Step 1: Create a session cluster.
For more information about how to create or manage catalogs, see Manage catalogs.
For more information about how to build a streaming data lakehouse, see Build a streaming data lakehouse by using Realtime Compute for Apache Flink and Apache Paimon.
For more information about the features of Realtime Compute for Apache Flink, see Release notes.