Flink Template Management
Flink templates include sample templates and custom templates. You can modify an existing sample template to meet the actual job logic requirements and save time for editing SQL statements. You can also customize a job template based on your habits and methods so that you can directly invoke or modify the template in later jobs.
Flink template management provides the following functions:
- Flink SQL Sample Template
- Custom Templates
- Creating a Template
- Creating a Job Based on a Template
- Modifying a Template
- Deleting a Template
Flink SQL Sample Template
The template list displays existing sample templates for Flink SQL jobs. Table 1 describes the parameters in the template list.
Parameter |
Description |
---|---|
Name |
Name of a template, which has 1 to 64 characters and only contains letters, digits, hyphens (-), and underlines (_). |
Description |
Description of a template. It contains 0 to 512 characters. |
Operation |
Create Job: Create a job directly by using the template. After a job is created, the system switches to the Edit page under . |
The existing sample templates apply to the following scenarios:
- Real-time ETL of Nginx access logs to the database
- Fake plate vehicle detection
- Geo-fencing alarm
- Vehicle yawing alarm
- Vehicle speeding alarm
- Stream-based random forest anomaly detection
- CloudTable-DLI Flink-CloudTable
- DIS-DLI Flink-CSS (Elasticsearch)
- DIS-DLI Flink-CloudTable (OpenTSDB)
- DIS-DLI Flink-CloudTable
- DIS-DLI Flink-DCS
- DIS-DLI Flink-DDS (MongoDB)
- DIS-DLI Flink-DIS
- DIS-DLI Flink-OBS-DWS
- DIS-DLI Flink-SMN
- Kafka-DLI Flink-Kafka
- OBS-DLI Flink-RDS
- Stream-Join-Table (DCS)
- Stream-Join-Table (RDS)
Custom Templates
The custom template list displays all Jar job templates. Table 1 describes parameters in the custom template list.
Parameter |
Description |
---|---|
Name |
Name of a template, which has 1 to 64 characters and only contains letters, digits, hyphens (-), and underlines (_). |
Description |
Description of a template. It contains 0 to 512 characters. |
Created |
Time when a template is created. |
Updated |
Latest time when a template is modified. |
Operation |
|
Creating a Template
You can create a template using any of the following methods:
- Creating a template on the
- In the left navigation pane of the DLI management console, choose > .
- Click Create Template in the upper right corner of the page. The dialog box is displayed.
- Specify Name and Description.
Table 3 Template parameters Parameter
Description
Name
Name of a template, which has 1 to 64 characters and only contains letters, digits, hyphens (-), and underlines (_).
NOTE:The template name must be unique.
Description
Description of a template. It contains 0 to 512 characters.
- Click OK to enter the page.
Job template parameters
Parameter
Description
Name
You can modify the template name.
Description
You can modify the template description.
Saving Mode
- Save Here: Save the modification to the current template.
- Save as New: Save the modification as a new template.
SQL statement editing area
In the area, you can enter detailed SQL statements to implement business logic. For details about how to compile SQL statements, see the Data Lake Insight SQL Syntax Reference.
Save
Save the modifications.
Create Job
Use the current template to create a job.
Format
Format SQL statements. After SQL statements are formatted, you need to compile SQL statements again.
Theme Settings
Change the font size, word wrap, and page style (black or white background).
- In the SQL statement editing area, enter SQL statements to implement service logic. For details about how to compile SQL statements, see the Data Lake Insight SQL Syntax Reference.
- After the SQL statement is edited, click Save in the upper right corner to complete the template creation.
- (Optional) If you do not need to modify the template, click Create Job in the upper right corner to create a job based on the current template. For details about how to create a job, see Creating a Flink SQL Job, and Creating a Flink Jar Job.
page
- Creating a template based on an existing job template
- In the left navigation pane of the DLI management console, choose Custom Templates tab. > . Click the
- In the row where the desired template is located in the custom template list, click Edit under Operation to enter the page.
- After the modification is complete, set Saving Mode to Save as New.
- Click Save in the upper right corner to save the template as a new one.
- Creating a template using a created job
- In the left navigation pane of the DLI management console, choose Flink Jobs page is displayed. > . The
- Click Create Job in the upper right corner. The Create Job page is displayed.
- Specify parameters as required.
- Click OK to enter the page.
- After the SQL statement is compiled, click Set as Template.
- In the Set as Template dialog box that is displayed, specify Name and Description and click OK.
- Creating a template based on the existing job
- In the left navigation pane of the DLI management console, choose Flink Jobs page is displayed. > . The
- In the job list, locate the row where the job that you want to set as a template resides, and click Edit in the Operation column.
- After the SQL statement is compiled, click .
- In the Set as Template dialog box that is displayed, specify Name and Description and click OK.
Creating a Job Based on a Template
You can create jobs based on sample templates or custom templates.
- In the left navigation pane of the DLI management console, choose > .
- In the sample template list, click Create Job in the Operation column of the target template. For details about how to create a job, see Creating a Flink SQL Job and Creating a Flink Jar Job.
Modifying a Template
After creating a custom template, you can modify it as required. The sample template cannot be modified, but you can view the template details.
- In the left navigation pane of the DLI management console, choose Custom Templates tab. > . Click the
- In the row where the template you want to modify is located in the custom template list, click Edit in the Operation column to enter the page.
- In the SQL statement editing area, modify the SQL statements as required.
- Set Saving Mode to Save Here.
- Click Save in the upper right corner to save the modification.
Deleting a Template
You can delete a custom template as required. The sample templates cannot be deleted. Deleted templates cannot be restored. Exercise caution when performing this operation.
- In the left navigation pane of the DLI management console, choose Custom Templates tab. > . Click the
- In the custom template list, select the templates you want to delete and click Delete in the upper left of the custom template list.
Alternatively, you can delete a template by performing the following operations: In the custom template list, locate the row where the template you want to delete resides, and click More > Delete in the Operation column.
- In the displayed dialog box, click Yes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot