Create and use an AnalyticDB for PostgreSQL node
In DataWorks, you can use an AnalyticDB for PostgreSQL node to develop and periodically schedule AnalyticDB for PostgreSQL tasks, and integrate them with other tasks. This topic outlines the development workflow.
Prerequisites
-
A workflow is created.
In DataStudio, you organize development tasks for different compute engines within 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 computing resource in DataWorks and associate it with DataStudio. This association lets you access data in the database for development.
-
You have purchased a serverless resource group (recommended) or an exclusive resource group for scheduling.
Background information
AnalyticDB for PostgreSQL nodes connect to Alibaba Cloud AnalyticDB for PostgreSQL. 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 you create the node, you can use it to develop and configure the task.
Step 2: Develop the AnalyticDB for PostgreSQL task
(Optional) Select an AnalyticDB for PostgreSQL computing resource
If your workspace has multiple AnalyticDB for PostgreSQL computing resources, you must select the resource to use. If only one exists, DataWorks uses it by default.
Develop SQL code
In the code editor of the AnalyticDB for PostgreSQL node, write SQL statements that comply with PostgreSQL syntax. For more information, see SQL syntax.
Step 3: Configure task scheduling
If you need to run a node task periodically, you can click Scheduling on the right side of the node editing page to configure scheduling information for the task based on your business requirements. For more information, see Overview of Task Scheduling Properties.
Before committing the node, you must configure its Rerun attribute and Parent Nodes.
Step 4: Debug the task code
Debug the task to verify that it runs correctly.
-
(Optional) Select a resource group and assign values to custom parameters.
-
Click the
icon in the toolbar. In the Parameter dialog box, select the resource group for scheduling to debug the task. -
If your task code uses scheduling parameter variables, you can assign values to them here for debugging. For more information about the parameter assignment logic, see Debug tasks.
-
-
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.
If you want to perform smoke testing in a development environment to check whether a task on a scheduling node runs as expected, you can perform the smoke test when the node is committed or after it is committed. For more information, see Perform smoke testing.
Step 5: Commit and deploy the task
After configuring the task, commit and deploy it. It will then run periodically according to its scheduling properties.
-
Click the
icon in the toolbar to save the node. -
Click the
icon in the toolbar to commit the node task.In the Submission dialog box, enter a Change Description. You can also request a code review after committing the node.
Note-
You cannot commit the node until you configure its Rerun attribute and Parent Nodes.
-
The code review feature helps ensure code quality and prevents errors caused by deploying faulty code to the production environment without review. If you enable code review, the committed code must be approved by a reviewer before it can be deployed. For more information, see Code review.
-
For a workspace in standard mode, you must deploy the task to the production environment after committing it. To do this, click Deploy in the upper-right corner of the node's editor page. For more information, see Deploy tasks.
Next steps
After the task is committed and deployed, it runs periodically based on its scheduling properties. You can click O&M Personnel in the upper-right corner of the node editor page to view the scheduling status and run history of the periodic task. For more information, see Manage periodic tasks.