Create and use an AnalyticDB for PostgreSQL node

Updated at:

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

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

  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 target workflow and choose Create Node > AnalyticDB for PostgreSQL > ADB for PostgreSQL.

  3. 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.

Note

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.

  1. (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.

  2. 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.

  3. (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.

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

  2. 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.