You can connect Davinci to your MaxCompute project for data visualization through simple UI configurations. This topic describes how to use the MaxCompute JDBC driver to connect Davinci to a MaxCompute project and perform visual data analysis.
Background information
Davinci is an end-to-end data visualization solution for business users, data engineers, data analysts, and data scientists. Its visual interface lets you analyze data with simple configurations and use features such as advanced interaction, industry analysis, pattern discovery, and social intelligence. For more information, see Davinci.
Prerequisites
Before you begin, 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-dependenciespackage.NoteThe 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: trueCustom data source configuration
If you install Davinci by following the official documentation, open the custom data source configuration file datasource_driver.yml and configure it as follows.
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, copy the MaxCompute JDBC driver JAR package to the lib directory and restart the Davinci service.
If you install Davinci by using Docker, you must manually create a data source configuration file named datasource_driver.yml. Run the
vim docker-compose.ymlcommand to open the configuration file and configure it as follows.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.ymlodps-jdbc-x.x.x-jar-with-dependencies.jaris the name of the MaxCompute JDBC driver JAR package, for example,odps-jdbc-3.2.9-jar-with-dependencies.jar. After the configuration is complete, restart the Davinci service.
Step 1: Connect Davinci to MaxCompute
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.
Start the Davinci service and log in.
In the upper-right corner of the Davinci interface, click New to create and save a project.
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 parameters as follows.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. The URL must be in the following format:
jdbc:odps:<Maxcompute_endpoint>?project=<Maxcompute_project_name>[&interactiveMode={true|false}]. When configuring the URL, remove the angle brackets (<>). The parameters are described as follows:-
<MaxCompute_endpoint>: Required. The endpoint for the region where your MaxCompute project is located.
For a list of endpoints by region, see Endpoints.
-
<MaxCompute_project_name>: Required. The name of the MaxCompute project to connect to.
This is the name of your MaxCompute project, not a workspace name. You can sign in to the MaxCompute console, switch to the correct 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=trueto the URL. For more information about this feature, see Query acceleration.
-
Click Test Connection. After the connection is successful, click Save.
Step 2: Query and analyze data
In Davinci, views are used to manage SQL templates and configure permissions for the data returned by SQL statements. Widgets then perform secondary aggregation and grouping on the data from views to create 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.