Use AnalyticDB for PostgreSQL nodes in DataWorks to develop and periodically schedule AnalyticDB for PostgreSQL tasks and integrate them with other tasks. This topic outlines the workflow for developing a task with an AnalyticDB for PostgreSQL node.
Prerequisites
-
A workflow is created.
DataStudio performs development operations based on workflows. Therefore, you must create a workflow before you create a node. For more information, see Create a workflow.
-
An AnalyticDB for PostgreSQL computing resource is associated with DataStudio.
You must add your AnalyticDB for PostgreSQL database as a DataWorks computing resource and associate it with DataStudio. This allows you to access the database's data for development.
-
A serverless resource group (recommended) or an exclusive resource group for scheduling is purchased.
Background information
AnalyticDB for PostgreSQL nodes connect to the Alibaba Cloud AnalyticDB for PostgreSQL service. For more information, see AnalyticDB for PostgreSQL.
Step 1: Create an AnalyticDB for PostgreSQL node
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 . On the page that appears, select the desired workspace from the drop-down list and click Go to Data Development.
-
Right-click the target workflow and choose .
-
In the Create Node dialog box, enter a Name for the node and click OK. After the node is created, you can develop and configure the task in the new node.
Step 2: Develop an AnalyticDB for PostgreSQL task
(Optional) Select a computing resource
If your workspace has multiple AnalyticDB for PostgreSQL computing resources, you must select the appropriate one on the node's editor page. If only one computing resource is available, it is selected by default.
Write SQL code
In the code editor of the AnalyticDB for PostgreSQL node, write SQL statements based on the syntax supported by PostgreSQL.
Step 3: Configure task scheduling
To run the task periodically, click Scheduling in the right-side panel of the node editor page. Configure the node's scheduling properties. For more information, see Overview of scheduling property configuration.
You must set the Rerun attribute and Parent Nodes properties for the node before you can commit it.
Step 4: Debug the task
Follow these steps to debug the task and verify that it runs correctly.
-
(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 scheduling resource group to use for debugging. -
If your code uses scheduling parameter variables, assign values to them for debugging. For more information about the parameter assignment logic, see Task debugging process.
-
-
Save and run the SQL statements.
Click the
icon in the toolbar to save the SQL statements. Then, click the
icon to run the SQL task. -
(Optional) Perform smoke testing.
To verify the scheduled task in the development environment, you can perform smoke testing during or after the commit. For more information, see Perform smoke testing.
Step 5: Commit and deploy
After configuring the task, you must commit and deploy it. The task will then run periodically as scheduled.
Click the
icon in the toolbar to save the node.-
Click the
icon in the toolbar to commit the task.In the Submission dialog box, enter a Change Description. You can also choose whether to perform a code review after the node is committed.
Note-
You must set the Rerun attribute and Parent Nodes properties for the node before you can commit it.
-
Code review improves code quality and prevents errors from unreviewed deployments. If you enable code review, a reviewer must approve the committed code before it can be deployed. For more information, see Code review.
-
If you use a workspace in standard mode, you must click Deploy in the upper-right corner of the editor after committing the task. This deploys the task to the production environment. For more information, see Deploy tasks.
Next steps
After the task is committed and deployed, it runs periodically as scheduled. You can click Operation Center in the upper-right corner of the node editor page to open Operation Center and view the task's scheduling status. For more information, see Manage periodic tasks.