Connect Davinci to MaxCompute

更新时间:
复制 MD 格式

Connect Davinci to your MaxCompute project for visual data analysis. You only need to configure a JDBC connection in the Davinci UI to start querying and visualizing MaxCompute data.

Background information

Davinci is a data visualization solution for business users, data engineers, data analysts, and data scientists. It provides advanced interaction, industry analysis, pattern discovery, and social intelligence features. For more information, see Davinci.

Prerequisites

Make sure that you meet the following requirements:

  • You have created a MaxCompute project.

    For more information, see Create a MaxCompute project.

  • You have obtained an AccessKey ID and AccessKey secret with permissions to access the MaxCompute project.

    You can obtain them from the AccessKey Management page.

  • You have downloaded the MaxCompute JDBC driver (v3.0.1 or later), specifically the jar-with-dependencies package.

    Note

    The MaxCompute JDBC driver version used in this topic for demonstration is v3.2.9.

  • You have installed and configured Davinci.

    You can install and configure Davinci by following the official Davinci documentation. For more information, see Install and configure Davinci. You can also install Davinci by using Docker and mount the MaxCompute JDBC driver successfully.

    When you configure Davinci and mount the driver, make sure that the MaxCompute-related information is correctly configured. For more information, see Configuration notes for Davinci and the driver.

Configure Davinci and the driver

When configuring Davinci and mounting the driver, ensure the following information is correct:

  • Mail configuration

    # Configuration information in the config/application.yml file.
    mail:
        # The SMTP service address.
        host: 
        # The SMTP service port.
        port: 
        # Your email address.
        username: 
        # You do not need to fill in this parameter.
        fromAddress: 
        # Your email authorization code. This is not your email password.
        password: 
        # The email display name, for example, Davinci.
        nickname: 
    # You can keep the following settings at their default values.
        properties:
          smtp:
            starttls:
              enable: true
              required: true
            auth: true
          mail:
            smtp:
              ssl:
                enable: true
  • Custom data source configuration

    • If you install Davinci by following the official documentation, open the custom data source configuration file datasource_driver.yml and add the following content.

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

      After configuration, copy the MaxCompute JDBC driver JAR package to the lib directory and restart the Davinci service.

    • If you install Davinci by using Docker, manually create a data source configuration file named datasource_driver.yml. Run the vim docker-compose.yml command to open the configuration file and add the following content.

      volumes:
            - /path/to/odps-jdbc-x.x.x-jar-with-dependencies.jar:/opt/davinci/lib/odps-jdbc-x.x.x-jar-with-dependencies.jar
            - /path/to/datasource_driver.yml:/opt/davinci/config/datasource_driver.yml

      odps-jdbc-x.x.x-jar-with-dependencies.jar is the name of the MaxCompute JDBC driver JAR package, for example, odps-jdbc-3.2.9-jar-with-dependencies.jar. After configuration, restart the Davinci service.

Step 1: Connect Davinci to MaxCompute

Note

Make sure Davinci is installed and configured correctly. If Davinci fails to start, re-check the configuration. For more information, see Configuration notes for Davinci and the driver.

  1. Start the Davinci service and log in.

  2. In the upper-right corner of the Davinci interface, click New to create and save a project.

  3. Navigate to the project you created. In the left-side navigation pane, click the 图标 icon, and then click the 添加 icon. In the Add Source dialog box, configure the following parameters.

    Parameter

    Description

    Name

    A unique name for the data connection.

    Type

    The driver used to connect to the MaxCompute project. This parameter is fixed to JDBC. Do not change it.

    Database

    The type of the target database. This parameter is fixed to odps. Do not change it.

    Username

    The AccessKey ID with permissions to access the MaxCompute project.

    You can go to the AccessKey Management page to obtain the AccessKey ID.

    Password

    The AccessKey secret that corresponds to the AccessKey ID.

    JDBC URL

    The URL used to connect to the MaxCompute project, in the following format: jdbc:odps:<Maxcompute_endpoint>?project=<Maxcompute_project_name>[&interactiveMode={true|false}]. Remove the angle brackets (<>) when configuring the URL. The parameters are described as follows:

    • <MaxCompute_endpoint>: Required. The endpoint of the region where your MaxCompute project is located.

      For a list of endpoints, see Endpoints.

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

      This is the name of your MaxCompute project, not a workspace. You can sign in to the MaxCompute console, switch the region in the upper-left corner, and find the project name on the Projects page.

    • interactiveMode: Optional. Specifies whether to enable the Query Acceleration feature.

      To enable Query Acceleration, append &interactiveMode=true to the URL. For more information, see Query Acceleration.

  4. Click Test Connection. After the connection is successful, click Save.

Step 2: Query and analyze data

Davinci uses views to manage SQL templates and data permissions. Widgets aggregate and group view data into visualizations. For more information, see Davinci Help.

  • View all tables

    On the view list page, click the 添加 icon in the upper-right corner to open the SQL editor. Select the data source you created to see all available tables.

  • View the table schema

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

  • View table data

    On the view list page, click the 添加 icon in the upper-right corner to open the SQL editor. Select the data source you created, write an SQL script, and then click Execute to view the table data.

  • Visualize and analyze data

    On the widget page, click the 添加 icon in the upper-right corner to open the chart editor. Select a chart type and configure its properties to analyze your data based on your business needs.