Help Center/ AI DataLake/ Best Practices/ Connecting BI Tools to AI DataLake Spark for Data Analysis/ Connecting Superset to AI DataLake Spark for Data Query and Analysis
Updated on 2026-11-06 GMT+08:00

Connecting Superset to AI DataLake Spark for Data Query and Analysis

Superset is an open-source data exploration and visualization platform. It supports fast and intuitive data exploration, and enables rich visualizations and interactive dashboards.

By interconnecting Superset with AI DataLake, you can access AI DataLake for data query and analysis. This simplifies data access workflows and provides unified data management and analytics for you to gain deeper insights into data.

This section describes the steps for connecting Superset to AI DataLake.

Preparations

Step 1: Install Superset and Configure the Data Connection Driver

  1. Download and install Superset.

    For details, see Installing Superset.

    The following uses Docker-based Superset installation as an example:

    1. Install Docker on the current host.
    2. Pull the Superset Docker image.
      docker pull apache/superset
    3. Start the Superset container.
      docker run -p 8088:8088 apache/superset

      This starts the Superset container and maps container port 8088 to host port 8088.

    4. Access Superset.

      In a browser, open http://IP address:8088 (replace IP address with the IP address of the host where Superset is deployed) and log in to Superset using the username and password configured during Superset installation.

  2. Install and configure the AI DataLake driver in Superset to connect to the database.

    The driver must be placed in the Superset classpath, for example, the superset-classpath directory.

    Decompress the installation package and install the AI DataLake driver on Superset.

    Run Python setup.py install to install the aidatalake-spark-python-sdk in the local environment.

  3. After installing the driver and completing the configuration, restart Superset to ensure that the driver takes effect.

Step 2: Connect Superset to AI DataLake

In Superset, add a database connection as follows:

  1. Open Superset and log in.
  2. Click Settings and select Database Connections.
    Figure 1 Selecting Database Connections from the Settings drop-down list
  3. In the displayed dialog box, select AIDataLake Spark for SUPPORTED DATABASES.
    Figure 2 Selecting AIDataLake Spark for SUPPORTED DATABASES
  4. Configure data connection details.

    Table 1 Parameters

    Parameter

    Description

    DISPLAY NAME

    Data connection name

    SQL ALCHEMY URI

    Data connection URI. The format is as follows:

    aidatalake_spark://<accesskey_id>:<accesskey_secret>@<region_id>/?projectid=<project_id>&workspaceid=<aidatalake workspaceid>&endpoint_name=<aidatalake_endpoint_name>&databasename=<aidatalake_default_database_name>&catalog=<lakeformation_catalog_name>&endpoint=<aidatalake url>&lakeformation_instance_id=<lakehouse instance id>
    The following table lists the parameters of the data connection URL.
    Table 2 Parameters for connecting Superset to AI DataLake

    Parameter

    Description

    Example Value

    accesskey_id and accesskey_secret

    AK and SK of the Huawei Cloud account

    For details about how to obtain the AK and SK, see AK/SK Obtaining.

    -

    region_id

    Region name of AI DataLake

    cn-north-7

    projectid

    AI DataLake project ID

    Hover the cursor over the account information in the upper right corner of the AI DataLake console, click My Credentials, and obtain the project ID.

    0b33ea2a7e******4c009bb05076d

    workspaceid

    AI DataLake workspace ID

    Log in to the AI DataLake console and find the target workspace ID on the workspace management page.

    spark

    endpoint_name

    Endpoint name of the AI DataLake service

    Log in to the AI DataLake console, choose Engine Endpoints > Spark, and find the target Spark endpoint name.

    spark-sql-test

    databasename

    Default database to access.

    default

    catalog

    Data catalog name

    • This parameter is mandatory when a LakeFormation catalog is used. Set it to the corresponding LakeFormation catalog name.

      When querying a LakeFormation catalog, ensure that there is a default database in the catalog.

    • If this parameter is not specified, an AI DataLake catalog is used. This parameter is not required when an AI DataLake catalog is used.

    For example, if a LakeFormation catalog named lfcatalog is used, the configuration is as follows: catalog=lfcatalog.

    endpoint

    URL of the AI DataLake service

    An endpoint is the request address for calling an API. Endpoints vary depending on services and regions. For the endpoints of all services, see Regions and Endpoints.

    https://aidatalake-test.cn-north-7.myhuaweicloud.com

    lakeformation_instance_id

    LakeFormation instance ID

    For details about how to obtain it, see How Do I Obtain the ID of a LakeFormation Instance?

    ae6dd098-***-*****-c02***def36d

  5. Click TEST CONNECTION to check whether the data source can be connected.

    If the message Connection looks good! is displayed, the connection is successful.

  6. Click CONNECT to save the connection.

Step 3: Query and Analyze Data Using Superset

  1. View table information.

    In the top menu of Superset, choose Datasets. On the right side, click +DATASET and set DATABASE, SCHEMA, and TABLE to preview table information.

    Figure 3 Previewing table information in Superset

  2. Click CREATE DATASET AND CREATE CHART in the lower right corner to create a dataset.

    Figure 4 Clicking CREATE DATASET AND CREATE CHART

  3. Visualize and analyze data.

    On the dataset page, select the target table and configure the chart type and dimensions to display business analytics charts.

    1. Select the database and table.
      Figure 5 Selecting the database and table
    2. Execute a SQL statement to query data.
      Figure 6 Executing a SQL statement to query data
    3. View the analysis result.
      Figure 7 Visual data analysis using Superset