Connect Metabase to MaxCompute
MaxCompute provides a Metabase driver to connect the open-source business intelligence (BI) tool Metabase to a MaxCompute project. This connection lets you query, analyze, and visualize your data to make data-driven decisions.
Version notes
-
The Metabase driver is currently in Preview. Its features are under active development.
-
This driver is based on Metabase v0.50. If you encounter any incompatibility issues or other problems, contact us through your dedicated DingTalk group or the MaxCompute Developer Community (DingTalk group ID: 11782920).
Prerequisites
-
You have Java Development Kit (JDK) 11 or a later version installed. You can download it from the official JDK website.
-
You have a MaxCompute project. For more information, see Create a MaxCompute project.
-
You have the latest version of the MaxCompute JDBC driver,
odps-jdbc-jar-with-dependencies.jar. You can download it from odps-jdbc.NoteThe MaxCompute JDBC driver must be v3.7.0 or later.
Step 1: Start Metabase
-
Download the Metabase JAR file and the Metabase MaxCompute driver.
-
Click Metabase to download the latest
metabase.jarfile. -
Click Metabase MaxCompute driver to download the driver file
maxcompute.metabase-driver.jar.
-
-
Create a new directory, for example
metabase_mc_dir, and move themetabase.jarfile into it. -
Inside the
metabase_mc_dirdirectory, create a subdirectory namedplugins. Move themaxcompute.metabase-driver.jarandodps-jdbc-jar-with-dependencies.jarfiles into thepluginsdirectory. -
Start Metabase.
Navigate to the
metabase_mc_dirdirectory and run the commandjava -jar metabase.jarto start Metabase.A successful startup displays messages similar to the following:
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 port conflict occurs during startup, you can change the default port (3000) by setting the MB_JETTY_PORT environment variable. Then, restart Metabase. For details, see Customizing the Metabase Jetty webserver.
After Metabase starts successfully, open a web browser and navigate to
http://localhost:<port>, whereportis your port number, to access the Metabase setup screen.
Step 2: Connect Metabase to MaxCompute
-
On the Metabase setup screen, follow the on-screen instructions for the initial configuration. When you reach the Add your data step, use the following method to add a MaxCompute database:
Note-
You can also select I'll add my data later in the Add your data section. After the setup is complete, you can add a MaxCompute database by following the instructions in Adding and managing databases.
-
For more information on the Metabase setup process, see setting-up-metabase.
-
In the Add your data section, search for and select MaxCompute.
-
Configure the connection parameters as follows:
Parameter
Description
Display name
Required. A display name for the database connection in Metabase.
Project
Required. The name of the MaxCompute project to access.
Endpoint
Required. The connection endpoint for the MaxCompute service.
You must configure the endpoint based on the region and network type of your MaxCompute project. For a list of endpoints, see Endpoints.
AccessKey ID
Required. The AccessKey ID of your Alibaba Cloud account or RAM user.
You can obtain this from the AccessKey Management page.
AccessKey secret
Required. The AccessKey secret that corresponds to your AccessKey ID.
timezone
Optional. The time zone, which affects how time-based values are displayed in Metabase. The default is
Asia/Shanghai.For a list of valid time zones, see Time zone list.
-
Click Connect to Database.
-
-
In the Metabase navigation pane, click Browse > Our data.
-
On the Databases page, click the display name of your MaxCompute database to view its tables.
Step 3: Query and analyze data
After adding the MaxCompute database, you can query and analyze your data in Metabase. For detailed guidance on these operations, see the Metabase documentation.
-
View all tables
On the Databases page, you can view all tables in the MaxCompute project. After you open a database, its tables are displayed as a grid of cards.
-
View a table schema
On the Databases page, click the
icon next to a table and select the Fields in this table tab to view its schema. -
View table data
On the Databases page, click a table name to view its data.
Alternatively, click the Query button in the upper-right corner. In the Actions area, click SQL query, select your database, and write SQL code to view and save table data.
-
Visualize and analyze data
After running a custom SQL query, you can build a dashboard to analyze the data. For more information, see Metabase dashboard.