A script template defines an SQL code process that includes multiple input and output parameters. You can use an SQL Script Template node to filter source table data, join source tables, and aggregate source table data to generate a result table. You can create an SQL Script Template node in Data Studio to reference a script template. This helps improve development efficiency. This topic describes how to reference and use a script template.
Prerequisites
The desired RAM user is added to your DataWorks workspace as a member and assigned the Development or Workspace Administrator role. Exercise caution when you assign the Workspace Administrator role because the role has more permissions than necessary. If you use a RAM user to develop tasks, this prerequisite is required. For more information about how to add a member, see Add workspace members and assign roles to them.
NoteIf you use an Alibaba Cloud account, ignore this prerequisite.
A workspace directory is created. For more information, see Workspace directories.
A script template is created. For more information, see Component management.
An SQL Script Template node is created. For more information, see Create a node.
Procedure
On the configuration tab of the SQL Script Template node, perform the following operations:
Reference a script template
In the right-side navigation pane of the configuration tab of the node, click the Settings for SQL Script Template tab. In the Reference Settings section of the Settings for SQL Script Template tab, select an SQL script template from the drop-down list.
NoteYou can click Update Code under the SQL Script Template drop-down list to update the version of the script template.
You can click Edit SQL Script Template to view the details of the script template.
If you select an SQL script template, the parameters in the SQL script template are automatically identified in the Parameter Configurations section. You can assign values to the parameters in the You must specify a value for the parameter text box.
Run a task on the SQL Script Template node
On the Debugging Configurations tab in the right-side navigation pane of the configuration tab of the node, configure the Computing Resource and Computing Quota parameters in the Computing Resource section and configure the Resource Group parameter in the DataWorks Configurations section.
NoteIf you want to access a data source over the Internet or a virtual private cloud (VPC), you must use the resource group for scheduling that is connected to the data source. For more information, see Network connectivity solutions.
In the top toolbar of the configuration tab of the node, click Run to run a task on the node.
If you want to run a task on the node on a regular basis, configure the scheduling information based on your business requirements. For more information, see Scheduling configuration.
After you configure the node, deploy the node. For more information, see Node/workflow release.
After you deploy the node, view the status of the node in Operation Center. For more information, see Getting started with Operation Center.