Connect Apache Superset to AnalyticDB for PostgreSQL

更新时间:
复制 MD 格式

Apache Superset is an open-source business intelligence (BI) tool for data exploration and visualization. Built on Python, it uses components such as Flask, Pandas, and SQLAlchemy. You can use Apache Superset to create visual, interactive, and collaborative documents. This topic describes how to connect Apache Superset to AnalyticDB for PostgreSQL to visualize and analyze data.

Prerequisites

Procedure

  1. Log in to Superset, and in the top menu bar, select Sources > > > Databases to go to the Databases page.

  2. In the upper-right corner of the page, click the 图标.png icon to open the Add Database page. Configure the following parameters.

    Parameter

    Description

    Database

    A custom name for the database connection.

    SQLAlchemy URI

    The connection string for your AnalyticDB for PostgreSQL database. The SQLAlchemy URI has the following format:

    postgresql+psycopg2://<AccessKey ID>:<AccessKey Secret>@<host>:<port>/<Database>

    The parameters are described as follows:

    • AccessKey ID and AccessKey Secret: The AccessKey ID and AccessKey Secret of your Alibaba Cloud account. To obtain them, see Create an AccessKey pair.

    • host: The internal endpoint of your AnalyticDB for PostgreSQL instance. Find the internal endpoint on the Database Connection page in the AnalyticDB for PostgreSQL console.

    • port: The port of your AnalyticDB for PostgreSQL instance. The default port is 5432.

    • Database: The name of the database in your AnalyticDB for PostgreSQL instance.

    For more information, see the SQLAlchemy documentation.

  3. Click the Test Connection button.

  4. If the connection is successful, click save at the bottom of the page.

    After saving the configuration, you can use AnalyticDB for PostgreSQL as a data source for visualization and analysis. For more information, see the Apache Superset documentation.