MaxCompute provides the Metabase driver. You can use the driver to connect the open source business intelligence (BI) tool Metabase to a MaxCompute project. Then, you can use Metabase to gain insights into data, analyze data, query data, and obtain formatted graphical views. This facilitates data-driven decision making.
Version information
The Metabase driver is in invitational preview. Features related to the Metabase driver are being constantly optimized.
The Metabase driver is developed based on Metabase 0.50. If you encounter issues such as version incompatibility, you can contact technical support in your private DingTalk group or join the DingTalk group of MaxCompute developers (ID: 11782920) for technical support.
Prerequisites
JDK 11 or later is downloaded and installed. To download JDK, visit the JDK official website.
A MaxCompute project is created. For more information, see Create a MaxCompute project.
The MaxCompute Java Database Connectivity (JDBC) driver
odps-jdbc-jar-with-dependencies.jar
is downloaded. You can click odps-jdbc to download the latest version of the driver.The version of the MaxCompute JDBC driver must be V3.7.0 or later.
Step 1: Start Metabase
Download the Metabase JAR package and the Metabase MaxCompute driver.
Click Metabase to download the Metabase JAR package
metabase.jar
of the latest version.Click Metabase MaxCompute Driver to download
maxcompute.metabase-driver.jar
, which is the JAR package of the Metabase MaxCompute driver.
Create a file directory, such as metabase_mc_dir, and move
metabase.jar
to the directory.Create a subdirectory named plugins in the metabase_mc_dir directory and move
maxcompute.metabase-driver.jar
andodps-jdbc-jar-with-dependencies.jar
to the plugins subdirectory.Start Metabase.
Go to the
metabase_mc_dir
directory and run thejava -jar metabase.jar
command to start Metabase.Metabase is started if the following information appears:
024-08-29 16:17:53,745 INFO metabase.task :: Task scheduler started 2024-08-29 16:17:53,746 INFO metabase.core :: Metabase Initialization COMPLETE in 27.7 s 2024-08-29 16:17:53,764 INFO task.refresh-slack-channel-user-cache :: Slack is not configured, not refreshing slack user/channel cache.
If a prompt indicating that the port number is occupied appears during the startup of Metabase, you can add the MB_JETTY_PORT environment variable to your on-premises machine to change the default port number 3000 to another port number, and then restart Metabase. For more information, see Customizing the Metabase Jetty webserver.
After Metabase is started, you can enter a URL in the
http://localhost:<port>
format in the address bar of a browser to access the initial UI of Metabase.
Step 2: Connect Metabase to MaxCompute
On the initial UI of Metabase, configure initialization settings for Metabase as prompted. On the Add your data page, perform the following operations to add a MaxCompute project as a database:
You can also choose to add data later on the Add your data page. After the initialization is complete, you can refer to Adding and managing databases to add a MaxCompute project as a database.
For information about how to initialize Metabase, see setting-up-metabase.
On the Add your data page, search for MaxCompute. In the search results, click MaxCompute to proceed to the next operation.
Configure the parameters that are described in the following table.
Parameter
Description
Parameter
Description
Display name
The display name of the MaxCompute database in Metabase. This parameter is required.
Project
The name of the MaxCompute project that you want to access. This parameter is required.
Endpoint
The endpoint of the MaxCompute service. This parameter is required.
You must configure this parameter based on the region and network connection mode that you selected when you create the MaxCompute project. For information about the endpoints that correspond to different regions and network connection modes, see Endpoints.
AccessID
The AccessKey ID of your Alibaba Cloud account or RAM user. This parameter is required.
You can go to the AccessKey Pair page in the RAM console to obtain the AccessKey ID.
AccessKey
The AccessKey secret that corresponds to the AccessKey ID. This parameter is required.
timezone
The time zone. This parameter is optional. The default value of this parameter is Asia/Shanghai. The value of this parameter affects the values of a time data type that are displayed in Metabase.
For more information about time zones, see Time zones.
Click Connect database.
In the left-side navigation pane of the Metabase page, choose BROWSE > Databases.
On the Databases page, click the display name of the created MaxCompute database to load the table information in the MaxCompute project.
Step 3: Use Metabase to query and analyze data
On the Metabase UI, you can query data in the MaxCompute project and analyze the data based on the added MaxCompute database. After the MaxCompute database is added, you can perform the following operations. For more information, see Metabase documentation.
Query all existing tables
On the Databases page, view information about all tables in the MaxCompute project.
Query a table schema
On the Databases page, click the
icon next to the name of the table whose schema you want to view. In the left-side navigation pane of the page that appears, click Fields in this table. On the page that appears, view the schema of the table.
Query table data
On the Databases page, find the table whose data you want to view and click the table name to view the data in the table.
You can also perform the following operations to view the data in a table: Click the search box in the upper-right corner of the Databases page, click New SQL query in the Actions section, select the added MaxCompute database, and then write SQL code to view the data in a specific table and save the data.
Analyze data in a visualized manner
After you create a table by writing custom SQL code, you can create a dashboard and configure the related parameters to perform data analysis based on your business requirements. For more information, see Metabase Dashboard.