A code template provides the content that is displayed at the beginning of the code for a node. You can configure a code template for the following types of nodes based on your business requirements: ODPS SQL, ODPS MR, and Shell.


  • Only a workspace administrator can modify code templates. If you want to modify a code template, you must obtain the permissions of a workspace administrator. For more information, see Manage roles and permissions.
  • You can configure code templates only for the following types of nodes: ODPS SQL, ODPS MR, and Shell.

Configure a code template

  1. Go to the Code Templates tab.
    1. Log on to the DataWorks console. In the top navigation bar, select the region where your workspace resides. In the left-side navigation pane, click Workspaces.
    2. On the Workspaces page, find your workspace and click Data Development in the Actions column to go to the DataStudio page.
    3. In the left-side navigation pane of the DataStudio page, click the Settings icon to go to the Settings page.
    4. On the Settings page, click Code Templates to go to the Code Templates tab.
  2. Configure a code template.
    1. Modify a code template.
      On the Code Template tab, find the code template that you want to modify and click Change in the Actions column. In the Node Template dialog box, you can modify the code template based on your business requirements. DataWorks provides the following types of default code templates:
      • Code template for ODPS SQL nodesODPS SQL
      • Code template for ODPS MR nodesODPS MR
      • Code template for Shell nodesSHELL
    2. After you modify the code template, click Save.
      After you create a node of one of the preceding types, the related code template is used for the node.