Connect Metabase to MaxCompute

Updated at:

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.

    Note

    The MaxCompute JDBC driver must be v3.7.0 or later.

Step 1: Start Metabase

  1. Download the Metabase JAR file and the Metabase MaxCompute driver.

  2. Create a new directory, for example metabase_mc_dir, and move the metabase.jar file into it.

  3. Inside the metabase_mc_dir directory, create a subdirectory named plugins. Move the maxcompute.metabase-driver.jar and odps-jdbc-jar-with-dependencies.jar files into the plugins directory.

  4. Start Metabase.

    Navigate to the metabase_mc_dir directory and run the command java -jar metabase.jar to 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>, where port is your port number, to access the Metabase setup screen.

Step 2: Connect Metabase to MaxCompute

  1. 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.

    1. In the Add your data section, search for and select MaxCompute.

    2. 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.

    3. Click Connect to Database.

  2. In the Metabase navigation pane, click Browse > Our data.

  3. 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 image 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.