Connect Davinci to MaxCompute

Updated at: 2024-07-30 05:52

MaxCompute allows you to connect a MaxCompute project to Davinci. You can use various data visualization applications based on simple configurations on the Davinci UI. This topic describes how to use a MaxCompute Java Database Connectivity (JDBC) driver to connect Davinci to a MaxCompute project and analyze data in a visualized manner.

Background information

Davinci is an end-to-end data visualization solution for business personnel, data engineers, data analysts, and data scientists. You can analyze data based on simple configurations on the Davinci UI. You can also implement visualization features such as advanced interaction, industry analysis, pattern exploration, and social intelligence. For more information about Davinci, see Davinci.

Prerequisites

Make sure that the following conditions are met:

Precautions for configuring Davinci and mounting a driver

When you configure Davinci and mount a driver, make sure that the following configurations are valid:

  • Mail configuration

    # Configure information in the application.yml file in the config directory. 
    mail:
        # The Simple Mail Transfer Protocol (SMTP) endpoint of a free email address. 
        host: 
        # The SMTP service port of a free email address. 
        port: 
        # The personal email address.
        username: 
        # Not required.
        fromAddress: 
        # An authorization code for the personal email address. This information is not the password of the email address. 
        password: 
        # The nickname of the email address, such as Davinci.
        nickname: 
    # Retain default values for the following configuration items. 
        properties:
          smtp:
            starttls:
              enable: true
              required: true
            auth: true
          mail:
            smtp:
              ssl:
                enable: true
  • Custom data source configuration

    • If you install Davinci based on the instruction provided in the official documentation of Davinci, open the custom data source configuration file datasource_driver.yml and configure the following information:

      odps:
          name: odps
          desc: odps
          version:
          driver: com.aliyun.odps.jdbc.OdpsDriver
          keyword_prefix:
          keyword_suffix:
          alias_prefix: \`
          alias_suffix: \`

      After the configuration is complete, manually copy the JAR package of the MaxCompute JDBC driver to the lib directory and restart Davinci.

    • If you use Docker to install Davinci, you must manually create a data source configuration file datasource_driver.yml and run the vim docker-compose.yml command to open the configuration file. The following sample code shows the configuration.

      volumes:
            - %Directory of odps-jdbc-x.x.x-jar-with-dependencies.jar%/odps-jdbc-x.x.x-jar-with-dependencies.jar:/opt/davinci/lib/odps-jdbc-x.x.x-jar-with-dependencies.jar
            - %Directory of datasource_driver.yml%/datasource_driver.yml:/opt/davinci/config/datasource_driver.yml

      odps-jdbc-x.x.x-jar-with-dependencies.jar is the name of the JAR package of the MaxCompute JDBC driver, such as odps-jdbc-3.2.9-jar-with-dependencies.jar. After the configuration is complete, restart Davinci.

Step 1: Connect Davinci to MaxCompute

Note

Davinci can be started only after it is installed and configured as expected. If Davinci fails to start, you must check the Davinci configuration information again. For more information, see Precautions for configuring Davinci and mounting a driver.

  1. Start and log on to Davinci.

    For more information about how to log on to Davinci, see Log on to Davinci.

  2. On the Davinci service page, click Create in the upper-right corner to create a project and save the project.

  3. Go to the project that you create. In the left-side navigation pane, click the 图标 icon. On the page that appears, click the 添加 icon. In the Add Source dialog box, configure the parameters. The following table describes the parameters.

    Parameter

    Description

    Parameter

    Description

    Name

    The name of the new data source. The name is used to distinguish the connections of different databases in the system.

    Type

    The driver that is used to access the MaxCompute project. Set the value to JDBC.

    Database

    The type of the destination database to which you want to connect. Set the value to odps.

    Username

    The AccessKey ID that is used to access the MaxCompute project.

    You can obtain the AccessKey ID on the AccessKey Pair page.

    Password

    The AccessKey secret that corresponds to the AccessKey ID.

    You can obtain the AccessKey secret on the AccessKey Pair page.

    URL

    The URL that is used to connect to the MaxCompute project. The format is jdbc:odps:<Maxcompute_endpoint>?project=<Maxcompute_project_name>[&interactiveMode={true|false}]. Delete the angle brackets (<>) when you configure this parameter. Parameters in the format:

    • <MaxCompute_endpoint>: required. The endpoint of MaxCompute. Configure this parameter based on the region where the MaxCompute project resides.

      For more information about the endpoints of MaxCompute in different regions, see Endpoints.

    • <MaxCompute_project_name>: required. The name of the MaxCompute project.

      This parameter specifies the name of your MaxCompute project instead of the DataWorks workspace to which the MaxCompute project corresponds. You can log on to the MaxCompute console, select the region where your MaxCompute project resides in the top navigation bar, and then view the name of the MaxCompute project on the Project management tab.

    • interactiveMode: optional. This parameter specifies whether to enable the MaxCompute Query Acceleration (MCQA) feature.

      If you want to enable the MCQA feature, add &interactiveMode=true to the end of the URL. For more information about the MCQA feature, see Query acceleration.

  4. Click Test. After the connection succeeds, click Save.

Step 2: Use Davinci to query and analyze data

You can use Davinci views to manage SQL templates, configure data models that are obtained after SQL statements are executed, and configure row and column permissions. Then, you can use widgets to further aggregate and group SQL results based on the data models provided by the views. You can encode the processed data in a visualized manner. You can perform the following operations. For more information, see Davinci help.

  • Query all existing tables

    On the data view page, click the 添加 icon in the upper-right corner to open the SQL editor and select the data source that you create to view all tables.

  • Query a table schema

    On the data view page, click the 添加 icon in the upper-right corner to go to the SQL editor. Select the data source that you create, write and run an SQL script, and then click Next to view the table schema information.

  • Query table data

    On the data view page, click the 添加 icon in the upper-right corner to go to the SQL editor. Select the data source that you create, write an SQL script, and then click Run to view table data.

  • Visualize analysis data

    On the Visualization Components page, click the 添加 icon in the upper-right corner to go to the chart editor. Select a chart type and configure properties. Then, you can analyze data based on your business requirements.

  • On this page (1, T)
  • Background information
  • Prerequisites
  • Precautions for configuring Davinci and mounting a driver
  • Step 1: Connect Davinci to MaxCompute
  • Step 2: Use Davinci to query and analyze data
Feedback