Use AnalyticDB for MySQL nodes in DataWorks to write, run, and periodically schedule SQL tasks against your AnalyticDB for MySQL cluster, and integrate those tasks with other node types in a workflow.
Prerequisites
Before you begin, ensure that you have:
-
(RAM users only) A RAM user added to the DataWorks workspace as a member with the Development or Workspace Administrator role. Assign Workspace Administrator only when the user needs full administrative access. For details, see Add members to a workspace.
If you use an Alibaba Cloud account, skip this prerequisite.
-
An AnalyticDB for MySQL 3.0 computing resource associated with the workspace
-
An AnalyticDB for MySQL node created. See the Create auto triggered tasks section in the node development topic.
Limitations
You cannot separately use a SET statement in the code of an AnalyticDB for MySQL node. They must be executed with other SQL statements.
Background information
AnalyticDB for MySQL is an analytical database of Alibaba Cloud. For more information, see What is AnalyticDB for MySQL?
Develop and run an AnalyticDB for MySQL node
Step 1: Write the SQL code
Open the configuration tab of your AnalyticDB for MySQL node. In the code editor, write the SQL you want to execute.
To pass dynamic values at runtime, define variables in the ${variable} format directly in the SQL. Then, in the Properties tab, go to the Scheduling Parameters section and assign a scheduling expression to each variable. DataWorks substitutes the expression values into the SQL each time the node runs.
Example:
SHOW ${var};
In the sample code, you can set${var}to theTABLESfield.
For the full list of supported scheduling expressions, see Sources and expressions of scheduling parameters.
Step 2: Configure and run the node
-
Click the Run Configuration tab and set the following fields:
Field Description Required Computing Resource The AnalyticDB for MySQL V3.0 computing resource registered in DataWorks Required Resource Group A scheduling resource group connected to the computing resource. Network connectivity between the resource group and the computing resource must be in place. Required For network connectivity requirements, see Network connectivity solutions.
-
In the upper part of the code editor, click the Select DataSource drop-down list and select the AnalyticDB for MySQL V3.0 computing resource.
-
Click Run in the top toolbar to execute the node immediately.
Step 3: Configure scheduling (optional)
To run the node automatically on a recurring basis, configure the schedule on the Properties tab based on your requirements. For details, see Node scheduling configuration.
Step 4: Deploy the node
After configuration is complete, deploy the node to make it available for scheduled runs. For details, see Deploy a node or a workflow.
Step 5: Monitor node runs
After deployment, go to Operation Center to view the running status of the node. For details, see Getting started with Operation Center.
What's next
-
To explore other node types and how to combine them into workflows, see the node development topic.