SQL script templates are SQL templates that involve multiple input and output parameters. Each SQL script template involves one or more source tables. You can filter source table data, join source tables, and aggregate them.

Note You can only use SQL script templates in DataWorks Standard Edition or higher.


  1. Log on to the DataWorks console. In the left-side navigation pane, click Workspaces. On the Workspaces page, find the target workspace and click Data Analytics in the Actions column.
  2. Move the pointer over the Create icon and choose MaxCompute > SQL Snippet.
    Note A node name can be up to 128 characters in length.

    You can also find the target workflow, right-click MaxCompute, and choose Create > SQL Snippet.

  3. In the Create Node dialog box that appears, enter the node name, select the target folder, and click Commit.
    To improve development efficiency, you can also create data analytics nodes by using the script templates provided by workspace members and tenants.
    • The script templates provided by members of the current workspace are available on the Workspace-Specific tab.
    • The script templates provided by tenants are available on the Public tab.
  4. On the node configuration tab, select a script template from the Snippet drop-down list.

    After you edit the code of the SQL script template, you can save the code and commit the node. For more information, see SQL script template configuration tab.

  5. Click the Parameters tab in the right-side navigation pane to set parameters for the SQL script template.
  6. Configure the node properties.

    Click the Properties tab in the right-side navigation pane. On the Properties tab that appears, set the relevant parameters. For more information, see Properties.

  7. Commit the node.

    After the node properties are configured, click the Save icon in the upper-left corner. Then, commit or commit and unlock the node to the development environment.

  8. Deploy the node.

    For more information, see Deploy a node.

  9. Test the node in the production environment.

Upgrade the version of an SQL script template

When a new version is released for a script template, you can decide whether to upgrade the version of the script template used in your nodes to the latest version.

The script template upgrade mechanism allows developers to continuously upgrade script template versions. This mechanism enhances the process execution efficiency and optimizes the business performance.

For example, User A uses V1.0 of a script template that belongs to User B. Then, User B releases V2.0 for the script template. User A receives a notification of the new version. After comparing the code of the two versions, User A can decide whether to upgrade the script template to the latest version.

To upgrade an SQL script template, click Update Code and check whether the parameter configuration of the SQL script template is valid in the new version. Properly set parameters for the SQL script template of the new version according to the version description. Then, save the node and commit it for deployment.