A script template defines an SQL code process that includes multiple input and output parameters. You can use an SQL code process to filter source table data, join source tables, and aggregate source table data to generate an output table. You can create an SQL Snippet node in DataStudio to reference a script template. This helps improve development efficiency. This topic describes how to create an SQL Snippet node and reference a script template.
Prerequisites
- DataWorks edition
DataWorks Standard Edition or a more advanced edition is activated. For more information, see Differences among DataWorks editions.
- Engine configuration
A MaxCompute compute engine is associated with the workspace in which you want to create an SQL Snippet node. The MaxCompute service is available in a workspace only after you associate a MaxCompute compute engine with the workspace on the Workspace Management page. For more information, see Associate a MaxCompute compute engine with a workspace.
- Preparation of script templates
A desired script template is created. For more information, see Create and manage a script template.
Limits
Only DataWorks Standard Edition or a more advanced edition supports SQL Snippet nodes. For more information, see Differences among DataWorks editions.
Create an SQL Snippet node and reference a script template
- Go to the DataStudio page.
- Log on to the DataWorks console.
- In the left-side navigation pane, click Workspaces.
- In the top navigation bar, select the region where the workspace resides. On the Workspaces page, find the workspace in which you want to create tables, and click DataStudio in the Actions column.
- Create a workflow. If you have an existing workflow, skip this step.
- Move the pointer over the icon and select Create Workflow.
- In the Create Workflow dialog box, configure the Workflow Name parameter.
- Click Create.
- Create an SQL Snippet node.
- Reference a script template. On the configuration tab of the SQL Snippet node, follow the instructions described in the following figure to reference a script template.
- Configure scheduling properties. If you want the system to periodically run the SQL Snippet node, click Properties in the right-side navigation pane to configure scheduling properties for the node based on your business requirements.
- Configure basic properties for the SQL Snippet node. For more information, see Configure basic properties.
- Configure the scheduling cycle, rerun properties, and scheduling dependencies of the SQL Snippet node. For more information, see Configure time properties and Scheduling dependency configuration guide. Note You must configure the Rerun and Parent Nodes parameters on the Properties tab before you commit the node.
- Configure resource properties for the SQL Snippet node. For more information, see Configure the resource property.
- Commit and deploy the MySQL node.
- Click the icon in the top toolbar to save the node.
- Click the icon in the top toolbar to commit the node.
- In the Commit Node dialog box, configure the Change description parameter.
- Click OK.
If you use a workspace in standard mode, you must deploy the node in the production environment after you commit the node. On the left side of the top navigation bar, click Deploy. For more information, see Deploy nodes. - View the MySQL node.
- Click Operation Center in the upper-right corner of the configuration tab of the MySQL node to go to Operation Center in the production environment.
- View the scheduled MySQL node. For more information, see View and manage auto triggered nodes.
To view more information about the node, click Operation Center in the top navigation bar of the DataStudio page. For more information, see Overview.