AnalyticDB for MySQL

更新时间:
复制 MD 格式

You can use AnalyticDB for MySQL nodes in DataWorks to develop tasks, run them periodically, and integrate them with other jobs. This topic describes how to develop a task using an AnalyticDB for MySQL node.

Prerequisites

Background information

AnalyticDB for MySQL is an analytical database service provided by Alibaba Cloud. For more information, see What is AnalyticDB for MySQL?

Step 1: Create an AnalyticDB for MySQL node

  1. Go to the DataStudio page.

    Log on to the DataWorks console. In the top navigation bar, select the desired region. In the left-side navigation pane, choose Data Development and O&M > Data Development. On the page that appears, select the desired workspace from the drop-down list and click Go to Data Development.

  2. Right-click the workflow and choose Create Node > AnalyticDB for MySQL > ADB for MySQL.

  3. In the Create Node dialog box, enter a Name for the node and click OK. The node's configuration tab opens, where you can develop and configure the task.

Step 2: Develop an AnalyticDB for MySQL task

Select a computing resource (optional)

If your workspace has multiple AnalyticDB for MySQL computing resources, select the one you want to use on the node configuration tab. If only one is available, it is used by default.

Develop SQL code

In the code editor of the AnalyticDB for MySQL node, write the SQL code for the task. The following code is an example:

SHOW TABLES;

Step 3: Configure task scheduling

To run the task on a schedule, click Scheduling in the right-side pane of the node configuration tab to configure its scheduling properties. For more information about the configurations, see Configure scheduling properties for a node.

Note

You must set the Rerun attribute and Parent Nodes properties for the node before you commit it.

Step 4: Debug the task code

Follow these steps to debug the code and verify that the task runs as expected.

  1. (Optional) Select a resource group for running the task and assign values to custom parameters.

    • Click the 高级运行 icon in the toolbar. In the Parameter dialog box, select the resource group to use for debugging.

    • If your code uses scheduling parameters, assign values to them for debugging. For more information about the value assignment logic, see Debug an auto-triggered node.

  2. Save and run the SQL statements.

    Click the 保存 icon in the toolbar to save the SQL statements, and then click the 运行 icon to run the SQL task.

  3. (Optional) Perform smoke testing.

    To verify that the scheduled task runs as expected in the development environment, you can perform smoke testing when you commit the node or anytime after. For more information, see Perform smoke testing.

Step 5: Commit and deploy the task

After you configure the node task, commit and deploy it. Once deployed, the task runs periodically based on its scheduling properties.

  1. Click the 保存 icon in the toolbar to save the task.

  2. Click the 提交 icon in the toolbar to commit the task.

    In the Submission dialog box, enter a Change Description of the change. You can also specify whether to perform code review after the task is committed.

    Note
    • Before committing the task, you must set the node's Rerun attribute and Parent Nodes properties.

    • Code review ensures code quality and prevents the deployment of faulty code to the production environment. If you enable code review, a reviewer must approve the committed code before it can be deployed. For more information, see Code review.

If your workspace is in standard mode, after committing the task, click Deploy in the upper-right corner of the node configuration tab to deploy it to the production environment. For more information, see Deploy tasks.

Next steps

After a task is deployed, it runs according to its schedule. To view the run status, click O&M Personnel in the upper-right corner of the node configuration tab. For more information, see View and manage auto-triggered tasks.