edit-icon download-icon

Script development

Last Updated: Apr 11, 2018

Scripts, as a supplement to periodic tasks, are generally used to facilitate the data development and process the non-periodic temporary data, such as adding, deleting, and modifying temporary tables. Therefore, scripts do not have periodic properties and dependencies.

Only ODPS_SQL and SHELL scripts are supported, which must run and take effect on the page and cannot be released. The procedures to create, edit, save, and run the script are mentioned as follows.

ScriptWorkflow

Create a script

  1. Log on to the DataWorks console, and click Enter Project to enter the project management page.

  2. Click Data Development, and select New > Create script.

  3. Complete the configurations in a Create script dialog box.

    CreateScript

    • File name: Enter the script name.
    • Type: Select the script type (ODPS_SQL or SHELL).
    • Description: Enter the description of the script.
    • Select directory: Select the directory to store the script.
  4. After the configurations, click Submit. The script is created successfully.

  5. Open the created script to edit it.

Edit, save, and run

Edit a script

Scripts are generally used to process the non-periodic temporary data, such as adding, deleting, and modifying temporary tables, initializing data at a time, or querying tasks. After editing the script, click Save so as to view the last saved content when you open the page the next time.

Run codes

After saving the script, select part of the codes and click Run. All the codes run, if you click Run without selecting any code.

If you are using an ODPS_SQL script, see MaxCompute SQL overview and MaxCompute SQL limits.

If you are using a SHELL script, see standard SHELL syntax for reference.

Note:

  • Running an ODPS_SQL script consumes a certain amount of computing and storage resources. Therefore, the cost is generated. For this reason, before Pay-As-You-Go users run an ODPS_SQL script, a Consumption Reminder dialog box appears. It provides a rough estimate of fees you may be billed for. The script does not run until you agree and confirm your decision pertaining to fees. If you agree, click Run to proceed.

  • The estimated fees listed in the Consumption Reminder dialog box is only for your reference so that you can get a picture of the fees you may pay for the current run. The amount less than one cent is estimated as one cent. The actual fee is a subject to the provided bill.

  • Currently, billing only applies to MaxCompute during the data development supported by DataWorks. Therefore, the Consumption Reminder feature is only supported for ODPS_SQL tasks and scripts.

View logs

When the task is triggered, the log page appears at the end of the editing area. If the statement running result returns to the data set, the result page appears next to the log page. The result page supports features such as copying by rows or columns. After the download feature is enabled in the project configuration, results support being downloaded on the result page.

Only one log page is provided, regardless of how many times the task runs. The page displays only the logs of the last run, with all the previous logs overwritten. A maximum of 20 result pages are displayed in the statement running order to make it easier to perform operations such as data comparison.

When multiple statements are triggered, they run in a serial order, with logs displayed on the log page in a sequence and results displayed on different result pages, based on the running order of statements.

Delete a script

Right-click the selected script and click Delete.

DeleteScript

Other features

1Search: Enter the keyword to search.

1Create directories: Enter a directory name to create a directory under the Script Development.

1Refresh: Refresh the current Script Development directory.

1 Locate the file tree: Locate the directory where the current script resides.

Thank you! We've received your feedback.