All Products
Search
Document Center

DataWorks:Create and use a MySQL node

Last Updated:Jan 16, 2024

You can create a MySQL node and use SQL statements to develop data for a MySQL data source. This topic describes how to create and use a MySQL node.

Prerequisites

  • MySQL nodes can use only exclusive resource groups for scheduling. For more information about how to create and use an exclusive resource group for scheduling, see Create and use an exclusive resource group for scheduling.

  • A MySQL data source is added in connection string mode. For more information, see Add a MySQL data source.

  • The MySQL data source is connected to an exclusive resource group for scheduling.

  • If your workspace is in standard mode, the MySQL data source is configured for both production and development environments. In a workspace in standard mode, when you select a data source on the configuration tab of a MySQL node, you cannot select a data source that is configured only for the development environment.

Limits

  • MySQL nodes can be used to develop data only for MySQL data sources that are in the production environment and that are added in connection string mode. You can go to the Data Source page based on the instructions in Add a MySQL data source, find the desired data source, and then click Edit in the Operation column to view the mode in which the data source is added.

  • MySQL nodes do not support data sources of MySQL 8.0 or later.

Network connectivity

  • Network connectivity description

    When a MySQL node runs, it needs to access the MySQL service. Therefore, you must make sure that the MySQL data source selected for the node is connected to the exclusive resource group for scheduling on which the node runs. For more information about how to connect a data source to an exclusive resource group for scheduling, see Associate an exclusive resource group with a VPC.

  • IP address whitelist configuration

    If an IP address whitelist is configured for the MySQL data source selected for a MySQL node, you must add the required information about the exclusive resource group for scheduling on which the node runs to the whitelist. For more information, see Configure an IP address whitelist for a data source.

  • Network connectivity test

    To test network connectivity, perform the following steps: Go to the Data Source page, find the desired MySQL data source, and then click Edit in the Operation column. In the Edit MySQL Data Source dialog box, select Schedule for Resource Group connectivity and click Test connectivity. For information about how to add a MySQL data source, see Add a MySQL data source. For more information about how to test network connectivity, see Test network connectivity.

Create and use a MySQL node to develop data

  1. Go to the DataStudio page.

    Log on to the DataWorks console. In the left-side navigation pane, choose Data Modeling and Development > DataStudio. On the page that appears, select the desired workspace from the drop-down list and click Go to DataStudio.

  2. Create a workflow.

    If you have an existing workflow, skip this step.

    1. Move the pointer over the Create icon and select Create Workflow.

    2. In the Create Workflow dialog box, configure the Workflow Name parameter.

    3. Click Create.

  3. Create a MySQL node.

    1. Move the pointer over the Create icon and choose Create Node > Database > MySQL.

      You can also right-click the name of the workflow that you created and choose Create Node > Database > MySQL.

    2. In the Create Node dialog box, configure the Name, Node Type, and Path parameters.

      Note

      The node name cannot exceed 128 characters in length and can contain only letters, digits, underscores (_), and periods (.).

    3. Click Commit. The configuration tab of the MySQL node appears.

  4. Use the MySQL node to develop data.

    1. Select a data source.

      Select the data source that you want to use to develop data from the Select Data Source drop-down list. If you cannot find the data source that you want to use from the drop-down list, click Add Data Source and add a data source on the Data Source page. For more information, see Add a MySQL data source.

      Note
      • In a workspace in standard mode, only MySQL data sources that are configured for both production and development environments are displayed in the Select Data Source drop-down list.

      • MySQL nodes can be used to develop data only for MySQL data sources that are in the production environment and that are added in connection string mode. You can go to the Data Source page based on the instructions in Add a MySQL data source, find the desired data source, and then click Edit in the Operation column to view the mode in which the data source is added.

    2. Select a resource group.

      In the top toolbar, click the Run with Parameters icon. In the Parameters dialog box, select the created resource group for scheduling.

      Note
      • If you want to access a data source over the Internet or a VPC, you must use the resource group for scheduling that is connected to the data source. For more information, see Establish a network connection between a resource group and a data source.

      • If you want to change the resource group in subsequent operations, you can also click the Run with Parameters icon to change the resource group in the Parameters dialog box.

    3. Use SQL statements to create a task.

      Write SQL statements in the SQL editor to create a task. SQL editor

      In this example, the following statement is used to query data in the xc_emp table. You can write SQL statements that you want to execute based on your business requirements and the syntax that is supported by MySQL.

      select * from xc_emp;

      The following figure shows the results. Results

      If the task fails, you can view the error message and troubleshoot the issue based on the instructions in When the node runs, the system displays an error message indicating that the JDBC driver is not supported. What do I do?

    4. Save and execute the SQL statements.

      In the top toolbar, click the Save icon to save the SQL statements. Then, click the Run icon to execute the SQL statements.

  5. Configure scheduling properties for the node.

    If you want the system to periodically run the node, you can click Properties in the right-side navigation pane to configure scheduling properties for the node based on your business requirements.

  6. Commit and deploy the node.

    1. Click the Save icon in the top toolbar to save the node.

    2. Click the Submit icon in the top toolbar to commit the node.

    3. In the Commit Node dialog box, configure the Change description parameter.

    4. Click OK.

    If you use a workspace in standard mode, you must deploy the node in the production environment after you commit the node. On the left side of the top navigation bar, click Deploy. For more information, see Deploy nodes.

  7. View the node.

    1. Click Operation Center in the upper-right corner of the configuration tab of the node to go to Operation Center in the production environment.

    2. View the scheduled node. For more information, see View and manage auto triggered nodes.

    To view more information about the node, click Operation Center in the top navigation bar of the DataStudio page. For more information, see Overview.

When the node runs, the system displays an error message indicating that the JDBC driver is not supported. What do I do?

  • Problem description

    When I configure a MySQL data source that is not added in connection string mode, the node fails to run, and the system displays an error message indicating that SQL execution failed and the JDBC driver is not supported.

  • Cause

    A MySQL data source that is not added in connection string mode is used.

  • Solution

    Select a data source that is added in connection string mode. You can go to the Data Source page based on the instructions in Add a MySQL data source, find the desired data source, and then click Edit in the Operation column to view the mode in which the data source is added.

The connectivity test is successful, but the node fails to run. What do I do?

  • Possible cause 1: The resource group that is selected for the connectivity test is invalid. In this case, check whether a resource group for scheduling is selected for the connectivity test. For more information, see (Optional) Test the network connectivity of the exclusive resource group.

  • Possible cause 2: The resource group for scheduling that is used for the connectivity test is not selected to run the node. In this case, click the Run with Parameters icon to change the resource group for scheduling.