SelectDB node

更新时间:
复制 MD 格式

In DataWorks, a SelectDB node lets you develop and periodically schedule tasks for SelectDB. You can also integrate these tasks with other jobs.

Background

SelectDB is a new-generation, multi-cloud native, real-time data warehouse built on Apache Doris. It is designed for real-time, enterprise-scale big data analytics, providing a cost-effective and easy-to-use service. For more information, see SelectDB.

Prerequisites

  • A workflow is created.

    You must create a workflow before you create a node. For more information, see Create a workflow.

  • Create a SelectDB data source.

    To access your SelectDB database, you must add it as a data source in DataWorks. For instructions on how to create a data source, see Data Source Management. For information about how to use a SelectDB data source in DataWorks, see SelectDB data source.

    Note

    SelectDB nodes support only SelectDB data sources created using a JDBC connection string.

  • A network connection is established between your data source and a resource group.

    You must make sure that the desired data source is connected to the resource group that you want to use. For more information about how to configure network connectivity, see Establish a network connection between a resource group and a data source.

  • (Optional) If you use a RAM user for task development, the RAM user must be added to the workspace and granted the Development or Workspace Administrator role. The Workspace Administrator role provides extensive permissions. Grant this role with caution. For more information about how to add members to a workspace and grant roles to the members, see Add members to a workspace.

Limitations

This feature is available in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), China (Shenzhen), China (Chengdu), China (Hong Kong), Singapore, Malaysia (Kuala Lumpur), Germany (Frankfurt), US (Silicon Valley), and US (Virginia).

Step 1: Create a SelectDB 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 Business Flow and choose Create Node > Database > SelectDB.

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

Step 2: Develop a SelectDB task

(Optional) Select a SelectDB data source

If your workspace contains multiple SelectDB data sources, select the one you want to use from the drop-down list on the node editor page. If only one SelectDB data source exists, it is selected by default.

Note

SelectDB nodes support only SelectDB data sources created using a JDBC connection string.

Write SQL code: Basic example

In the code editor, write the SQL code for your task. For example:

SELECT * FROM usertablename;

Write SQL code: Use scheduling parameters

The Scheduling Parameter provided by DataWorks allow you to dynamically pass parameters to code in periodic scheduling scenarios. You can define a variable in the code of a node task by using the ${variable_name} format and assign a value to the variable in the Scheduling Configurations > Scheduling Parameter section in the right-side navigation bar of the node editing page. For more information about the supported formats and configuration details, see Supported formats of scheduling parameters and Configure and use scheduling parameters.

For example:

SELECT '${var}'; -- You can use this with scheduling parameters.

Step 3: Configure task scheduling

If you need to run the node task periodically, click the scheduling properties tab in the right-side navigation pane of the node editor page and configure scheduling properties for the task based on your business requirements. For more information, see Overview of task scheduling properties.

Note

Before you can commit the node, you must specify the Rerun attribute property and Parent Nodes for the node.

Step 4: Debug the task

To debug the task and check whether it runs as expected:

  1. (Optional) Select a resource group for scheduling and specify values for custom parameters.

    • Click the 高级运行 icon in the toolbar. In the Parameter dialog box, select the resource group for scheduling that you want to use for debugging.

    • If your task code uses scheduling parameters, you can specify values for them for debugging. For more information about how to specify parameter values, see Debug a task.

  2. Save and run the task code.

    Click the 保存 icon in the toolbar to save the task code and click the 运行 icon to run the task.

  3. (Optional) Perform smoke testing.

    To check if the scheduled task runs as expected in the development environment, you can perform smoke testing when you commit the node or after it is committed. For more information, see Perform smoke testing.

Step 5: Commit and deploy the task

After you configure the node task, you must commit and deploy it. Once deployed, the node runs on a schedule based on 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 select whether to perform a code review after you commit the node.

    Note
    • Before you can commit the node, you must specify the Rerun attribute property and Parent Nodes for the node.

    • Code review helps ensure code quality and prevents task errors that may result from deploying incorrect code to the production environment without being reviewed. If you enable code review, the submitted node code can be deployed only after reviewers approve it. 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 node editor page after you commit the task. This operation deploys the task to the production environment. For more information, see Deploy tasks.

Next steps

Task O&M: After the task is committed and deployed, it runs periodically based on its scheduling configuration. You can click Operation Center in the upper-right corner of the node editor to monitor its scheduling and operational status. For more information, see Manage auto-triggered tasks.