An AnalyticDB for PostgreSQL node allows you to develop, schedule, and integrate AnalyticDB for PostgreSQL tasks with other task types in DataWorks.
Prerequisites
You have bound a MaxCompute compute engine to the DataWorks workspace.
-
An AnalyticDB for PostgreSQL computing resource has been associated with the workspace
-
A project directory has been created. For more information, see Project directory.
-
An AnalyticDB for PostgreSQL node has been created. For more information, see Create a node for a scheduling workflow.
Background
An AnalyticDB for PostgreSQL node connects to Alibaba Cloud AnalyticDB for PostgreSQL. For more information, see AnalyticDB for PostgreSQL.
Procedure
-
On the edit page of the AnalyticDB for PostgreSQL node, follow these steps to develop a task.
Develop SQL code
In the SQL editor, write your task code. You can define variables in the code by using the ${variable_name} format. You can then assign values to these variables in the Scheduling Parameters section of the Scheduling Settings pane on the right. This lets you dynamically pass parameters to your code during scheduled runs. For more information about scheduling parameters, see Scheduling parameter sources and expressions. For example:
CREATE TABLE employees ( id INT PRIMARY KEY, name VARCHAR(100), age INT, department VARCHAR(50) ); INSERT INTO employees (id, name, age, ${var}) VALUES (1, 'Alice', 30, 'HR'), (2, 'Bob', 25, 'Engineering'), (3, 'Charlie', 35, 'Marketing');Note-
In the example, you can set the ${var} parameter to the
departmentcolumn. -
The code editor for the AnalyticDB for PostgreSQL node supports standard PostgreSQL syntax. For more information, see SQL syntax.
Run the SQL task
-
In the Debug Configuration section, configure Compute Resource and Resource Group.
-
For Computing resource, select the name of the AnalyticDB for PostgreSQL compute resource that you registered on DataWorks.
-
For Resource Group, select a resource group for scheduling that has passed the connectivity test with the compute resource. For more information, see Network connectivity.
-
-
Click the Select a data source drop-down list in the toolbar, select the AnalyticDB for PostgreSQL compute resource that you created in the dialog, and then click Run to run the SQL task.
-
-
To run the node task on a regular basis, configure the schedule settings based on your business requirements. For more information, see Configure schedule settings.
-
After the node task is configured, you must deploy the node. For more information, see Deploy a node.
-
After the task is deployed, you can view the running status of the scheduled task in Operation Center. For more information, see View scheduled tasks.