CREATE STREAMING JOB
Note:
Continuous Load is an experimental engine workflow. Confirm availability for your warehouse with VeloDB Cloud support before using this reference. For production loading alternatives, see loading methods.
Description
A streaming job is a continuous import task based on the Job approach. After the Job is submitted, The engine continuously runs the import job, querying TVF or upstream data sources in real time and writing the data into the warehouse tables.
Two modes are supported:
- TVF Mode: Uses
DO INSERT INTO ... SELECT FROM TVF()syntax to continuously write TVF data into a specified single internal table. Supports S3 TVF and CDC Stream TVF. - Multi-table CDC Mode: Uses
FROM <sourceType> TO DATABASEsyntax to continuously synchronize full and incremental data from multiple upstream database tables into the warehouse, automatically creating downstream tables on first sync.
For detailed usage, see Continuous Load.
Syntax
TVF mode
CREATE JOB <job_name>
[ PROPERTIES (
<job_property>
[ , ... ]
)
]
ON STREAMING
[ COMMENT <comment> ]
DO <Insert_Command>
Multi-table CDC mode
CREATE JOB <job_name>
[ PROPERTIES (
<job_property>
[ , ... ]
)
]
ON STREAMING
[ COMMENT <comment> ]
FROM <sourceType> (
<source_property>
[ , ... ]
)
TO DATABASE <target_db> (
<target_property>
[ , ... ]
)
Required parameters
1. <job_name>
The job name, which uniquely identifies an event in a database. The job name must be globally unique; if a job with the same name already exists, an error will be reported.
2. <Insert_Command> (TVF Mode)
The DO clause specifies the operation to be executed when the job is triggered, i.e., an INSERT INTO SELECT FROM TVF statement. Supports S3 TVF and CDC Stream TVF.
3. <sourceType> (Multi-table CDC Mode)
Supported data source types: currently supports
MYSQLandPOSTGRES.
4. <source_property> (Multi-table CDC Mode)
| Parameter | Default | Description |
|---|---|---|
| jdbc_url | - | JDBC connection string (MySQL/PostgreSQL) |
| driver_url | - | JDBC driver jar path |
| driver_class | - | JDBC driver class name |
| user | - | Database username |
| password | - | Database password |
| database | - | Database name |
| schema | - | Schema name (PostgreSQL) |
| include_tables | - | Tables to synchronize, comma separated. If not specified, all tables will be synchronized by default. |
| offset | latest | latest: incremental only (default); initial: full + incremental sync |
| snapshot_split_size | 40960 (checked Core 26.1.3 implementation) | Split size (in rows). During full sync, the table is divided into multiple splits. |
| snapshot_parallelism | 1 | Parallelism during full sync phase, i.e., max splits per task. |
5. <target_db> (Multi-table CDC Mode)
Target database name to import into.
6. <target_property> (Multi-table CDC Mode)
| Parameter | Default | Description |
|---|---|---|
| table.create.properties.* | - | Table properties when creating, e.g. replication_num |
| load.strict_mode | - | Whether to enable strict mode. Disabled by default. |
| load.max_filter_ratio | - | The maximum allowed filtering ratio within a sampling window. Must be between 0 and 1 (inclusive). The default value is 0, indicating zero tolerance. The sampling window equals max_interval * 10. If, within this window, the ratio of erroneous rows to total rows exceeds max_filter_ratio, the scheduled job will be paused and requires manual intervention to address data quality issues. |
Optional parameters
1. <job_property>
| Parameter | Default | Description |
|---|---|---|
| session.* | - | Supports configuring all session variables in job_properties (TVF Mode only) |
| s3.max_batch_files | 256 | Triggers an import write when the accumulated file count reaches this value (S3 TVF only) |
| s3.max_batch_bytes | 10737418240 | Triggers an import write when the accumulated data size (in bytes) reaches this value. Only a plain integer byte count is accepted, e.g. 10737418240; a unit suffix such as 10G is not supported. Valid range is 100MB–10GB, i.e. 104857600–10737418240. (S3 TVF only) |
| max_interval | 10 | Idle scheduling interval in seconds when there are no new files or data upstream. Only an integer (number of seconds) is accepted, e.g. 10; a unit suffix such as 10s is not supported. Must be >= 1 |
Privilege control
The user executing this SQL command must have at least the following privileges:
| Privilege | Object | Notes |
|---|---|---|
| LOAD_PRIV | Database | Currently, only the LOAD privilege is supported for this operation |
Notes
- TASK only retains the latest 100 records.
Examples
TVF mode
-
Create a job that continuously monitors files in a specified directory on S3 and imports data from CSV files into db1.tbl1.
CREATE JOB my_jobON STREAMINGDOINSERT INTO db1.`tbl1`SELECT * FROM S3("uri" = "s3://bucket/s3/demo/*.csv","format" = "csv","column_separator" = ",","s3.endpoint" = "https://s3.ap-southeast-1.amazonaws.com","s3.region" = "ap-southeast-1","s3.access_key" = "","s3.secret_key" = ""); -
Create a job that continuously synchronizes a single MySQL table into the warehouse using CDC Stream TVF.
CREATE JOB mysql_cdc_jobON STREAMINGDOINSERT INTO db1.target_tableSELECT * FROM cdc_stream("type" = "mysql","jdbc_url" = "jdbc:mysql://127.0.0.1:3306","driver_url" = "mysql-connector-java-8.0.25.jar","driver_class" = "com.mysql.cj.jdbc.Driver","user" = "root","password" = "123456","database" = "source_db","table" = "source_table","offset" = "initial"); -
Create a job that continuously synchronizes a single PostgreSQL table into the warehouse using CDC Stream TVF.
CREATE JOB pg_cdc_jobON STREAMINGDOINSERT INTO db1.target_tableSELECT * FROM cdc_stream("type" = "postgres","jdbc_url" = "jdbc:postgresql://127.0.0.1:5432/postgres","driver_url" = "postgresql-42.5.1.jar","driver_class" = "org.postgresql.Driver","user" = "postgres","password" = "postgres","database" = "postgres","schema" = "public","table" = "source_table","offset" = "initial");
Multi-table CDC mode
-
Create a job to synchronize user_info and order_info tables from MySQL upstream to the target_test_db database from the beginning.
CREATE JOB multi_table_syncON STREAMINGFROM MYSQL ("jdbc_url" = "jdbc:mysql://127.0.0.1:3306","driver_url" = "mysql-connector-java-8.0.25.jar","driver_class" = "com.mysql.cj.jdbc.Driver","user" = "root","password" = "123456","database" = "test","include_tables" = "user_info,order_info","offset" = "initial")TO DATABASE target_test_db ("table.create.properties.replication_num" = "1") -
Create a job to continuously synchronize incremental data from the test_tbls table in PostgreSQL upstream to the target_test_db database.
CREATE JOB test_postgres_jobON STREAMINGFROM POSTGRES ("jdbc_url" = "jdbc:postgresql://127.0.0.1:5432/postgres","driver_url" = "postgresql-42.5.1.jar","driver_class" = "org.postgresql.Driver","user" = "postgres","password" = "postgres","database" = "postgres","schema" = "public","include_tables" = "test_tbls","offset" = "latest")TO DATABASE target_test_db ("table.create.properties.replication_num" = "1")
Managed configuration
The following FE parameters are service-managed reference settings. Compiled defaults do not establish the effective warehouse values. Contact VeloDB Cloud support for capacity or retention changes.
| Parameter | Default | Description |
|---|---|---|
| max_streaming_job_num | 1024 | Maximum number of Streaming jobs |
| job_streaming_task_exec_thread_num | 10 | Number of threads for StreamingTask |
| max_streaming_task_show_count | 100 | Max number of StreamingTask records in memory |