Updated on 2024-04-29 GMT+08:00

Configuring a Template

This section describes how to create and use a Flink SQL template. When writing Flink SQL code, you can use an SQL template for repeated service logic. In addition, you can use a job parameter template when configuring job parameters.

Constraints

This function applies to the following scenarios:

  • Use a script template for a Flink SQL script.
  • During pipeline job development, use a Fink SQL script which uses a script template for the MRS Flink Job node and use a parameter template for Program Parameter of the MRS Flink Job node.
  • Use a script template in a single-task Flink SQL job.
  • Use template parameters in a single-task Flink JAR job.

Procedure

  1. On the DataArts Studio console, locate a workspace and click DataArts Factory.
  2. In the navigation pane, choose Configuration > Configure.
  3. Choose Templates.

    • Create a script template.
      1. On the Script Templates page, click Add.
      2. Set Template Name.
      3. Enter an SQL statement and reference script parameters.
      4. Configure the script template parameters. The parameter names cannot be changed, and the parameter values can be changed.
        Figure 1 Creating a script template

      5. Click Save.

        You can view, modify, or delete the created script template.

    • Create a parameter template.
      1. On the Parameter Templates page, click Add.
      2. Set Template Name.
      3. Click Add Parameter and set parameter names and values. You can modify or delete parameters.
        Figure 2 Creating a parameter template

      4. Click OK.

        You can view, modify, or delete the created parameter template.

        For details about the application scenarios of script templates and parameter templates, see Using Script Templates and Parameter Templates.