Updating a SQL Job
Function
The Stream SQL syntax is developed based on Apache Flink SQL. For details, see the Cloud Stream Service SQL Syntax Reference.
URI
- URI format
PATCH /v1.0/{project_id}/sql_job
- Parameter description
Table 1 URI parameter description Parameter
Mandatory
Description
project_id
Yes
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.
Request
- Example request
{ "job_id": 50320, "name": "myjob", "desc": "My first job", "cluster_id": 1000000, "sql_body": "select * from source_table", "run_mode": "shared_cluster", "spu_number": 4, "parallel_number": 4, "checkpoint_enabled": false, "checkpoint_mode": "exactly_once", "checkpoint_interval": 10, "obs_bucket": "", "log_enabled": false, "smn_topic": "", "restart_when_exception": false, "idle_state_retention": 0, "edge_group_ids": "" } - Parameter description
Table 2 Request parameters Parameter
Mandatory
Type
Description
job_id
Yes
Long
Job ID.
name
No
String
Job name.
desc
No
String
Job description.
cluster_id
No
Int
Resource ID of an exclusive cluster. Ensure that the current user has been authorized to use resources of the exclusive cluster.
sql_body
No
String
Stream SQL statement, which includes at least the following three parts: source, query, and sink.
run_mode
No
Int
Job running mode. The options are as follows:
- shared_cluster: indicates that the job is running on a shared cluster.
- exclusive_cluster: indicates that the job is running on an exclusive cluster.
- edge_node: indicates that the job is running on an edge node.
spu_number
No
Int
Number of SPUs selected for a job.
parallel_number
No
Int
Number of parallel jobs set by a user.
checkpoint_enabled
No
Boolean
Whether to enable the automatic job snapshot function.
- true: indicates to enable the automatic job snapshot function.
- false: indicates to disable the automatic job snapshot function.
- Default value: false
checkpoint_mode
No
Int
Snapshot mode. The values include:
Value 1 indicates that the event is processed only once. Value 2 indicates that the event is processed at least twice.
checkpoint_interval
No
Int
Snapshot interval, expressed by seconds.
obs_bucket
No
String
OBS path where users are authorized to save the snapshot. This parameter is valid only when is_checkpoint is set to true.
log_enabled
No
Boolean
Whether to enable the function of uploading job logs to users' OBS buckets.
smn_topic
No
String
If a job fails to work, CS pushes alarm information to the SMN topic.
restart_when_exception
No
Boolean
Whether to enable the function of automatically restarting a job upon job exceptions.
idle_state_retention
No
Int
How long the state of a key is retained without being updated before it is removed in GroupBy or Window.
edge_group_ids
No
String
List of edge computing group IDs. Use commas (,) to separate multiple IDs.
tags
No
String
Job tag.
sys_enterprise_project_id
No
String
ID of the enterprise project to which a job belongs.
udf_jar_url
No
String
OBS address where the SQL job UDF JAR file is stored.
dirty_data_strategy
No
String
Dirty data policy of a job.
- 2:obs-wan-wulan3/jobs: Save.
- 1: Trigger a job exception.
- 0: Ignore.
Response
- Example response
{ "message_id": "CS.10001", "message": "The job is updated successfully.", "payload": { "update_time": 1516952770835 }, "current_time": 1533686888000 } - Parameter description
Table 3 Response parameters Parameter
Mandatory
Type
Description
message_id
No
String
Message type ID.
message
No
String
Message content.
update_time
No
Int
Message update time, expressed by milliseconds.
current_time
No
Int
Current time, expressed by milliseconds.
payload
No
None
Information about job update.
update_time
No
Int
Job update time, expressed by milliseconds.
Status Code
Table 4 describes the status code.
Error Code
For details, see Error Codes.
Last Article: Creating a SQL Job
Next Article: Creating a User-Defined Job
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.