SQL scripts let you write and run CALL commands and DDL, DQL, and DML statements directly in the Development Console—without deploying a job. Use scripts to set up catalogs and tables, run queries, and manage Apache Paimon tables.
Key concepts
Statement types
Scripts support three categories of SQL statements, each with a distinct purpose:
| Type | Purpose | Examples |
|---|---|---|
| DDL (Data Definition Language) | Modify metadata—add, change, or delete objects like catalogs and tables. | CREATE CATALOG, CREATE TABLE, DROP TABLE |
| DML (Data Manipulation Language) | Change data in tables. | INSERT INTO, DELETE |
| DQL (Data Query Language) | Read and query data. | SELECT |
Scripts also support the CALL command and the EXPLAIN statement. Use EXPLAIN to view the execution plan for a statement and troubleshoot issues.
Executing DDL or DML statements directly can affect your metadata or data. Review statements carefully before running them.
Execution modes
Scripts run in either batch mode or streaming mode. Choose based on your data source:
| Mode | Data size | Use when |
|---|---|---|
| Batch | Bounded (fixed, finite) | Running queries on a static dataset—faster for bounded sources |
| Streaming | Bounded or unbounded (continuous, infinite) | Processing real-time data streams or sources without a defined end |
To switch to streaming mode, add a SET statement before your query:
SET 'execution.runtime-mode' = 'streaming';
Scripts do not support variables.
Auto-save
Scripts auto-save every minute. To save manually, click Save in the upper-right corner and specify a file name and storage location.
Prerequisites
Before you begin, ensure that you have:
-
Access to a Realtime Compute for Apache Flink workspace
-
A session cluster running Ververica Runtime (VVR) 8.0.4 or later. If none exists, create a session cluster.
Create and run a script
-
Log on to the Realtime Compute for Apache Flink console.
-
In the Actions column of your workspace, click Console.
-
In the Development Console, go to Development > Scripts and click the Scripts tab.
-
Click
to create a script. -
Enter your SQL statements. The following example creates a MySQL catalog and queries a table in streaming mode:
-- Create a MySQL catalog -- For parameter details, see: Create a MySQL catalog CREATE CATALOG mysql_catalog WITH( 'type' = 'mysql', 'hostname' = 'rm-bp1x********.mysql.rds.aliyuncs.com', 'port' = '3306', 'username' = 'db_user', 'password' = '${secret_values.mysqlpw}', 'default-database' = 'flinktest' ); -- Switch to streaming mode to query an unbounded source SET 'execution.runtime-mode' = 'streaming'; SELECT * FROM `mysql_catalog`.flinktest.orders;For full details on creating a MySQL catalog, see Create a MySQL catalog.
-
In the lower-right corner, click Environment and select a session cluster running VVR 8.0.4 or later.
-
Select the statement or statements to run, then click Run to the left of the selection.
-
(Optional) Click Save in the upper-right corner, then specify a file name and storage location.
FAQ
Why do I get the error "Querying an unbounded table 'XXX' in batch mode is not allowed"?
The source table is an unbounded stream—it has no defined end. Batch mode only works with bounded (finite) datasets. Add a SET statement before your query to switch to streaming mode:
SET 'execution.runtime-mode' = 'streaming';