content/influxdb3/cloud-dedicated/process-data/visualize/superset.md
Use Apache Superset to query and visualize data stored in an InfluxDB database.
<!-- TOC -->Apache Superset is a modern, enterprise-ready business intelligence web application. It is fast, lightweight, intuitive, and loaded with options that make it easy for users of all skill sets to explore and visualize their data, from simple pie charts to highly detailed deck.gl geospatial charts.
{{% cite %}}-- Apache Superset documentation{{% /cite %}}
We recommend using Docker and Docker Compose to run Superset. To set up Superset to run in Docker containers with Flight SQL, follow these steps:
[!Warning] Superset is not officially supported on Windows. For more information about running Superset with Windows and Docker, see the Superset documentation.
Follow the instructions to download and install Docker and Docker Compose for your system:
Follow the Python.org Downloading Python instructions for your system.
Once you've installed Python, check that you can run Python and Pip.
Depending on your system, you may need to use the Python version 3 (python3 and pip3) commands.
Enter the following commands into your terminal:
{{< code-tabs-wrapper >}} {{% code-tabs %}} python python3 {{% /code-tabs %}} {{% code-tab-content %}}
python --version
pip --version
{{% /code-tab-content %}} {{% code-tab-content %}}
python3 --version
pip3 --version
{{% /code-tab-content %}} {{< /code-tabs-wrapper >}}
If neither `pip` nor `pip3` works, follow one of the [Pypa.io Pip Installation](https://pip.pypa.io/en/stable/installation/) methods for your system.
3. Use Pip to install the flightsql-dbapi library.
{{< code-tabs-wrapper >}}
{{% code-tabs %}} pip pip3 {{% /code-tabs %}} {{% code-tab-content %}}
pip install flightsql-dbapi
{{% /code-tab-content %}} {{% code-tab-content %}}
pip3 install flightsql-dbapi
{{% /code-tab-content %}} {{< /code-tabs-wrapper >}}
The `flightsql-dbapi` library for Python provides a
[DB API 2](https://peps.python.org/pep-0249/) interface and
[SQLAlchemy](https://www.sqlalchemy.org/) dialect for
[Flight SQL](https://arrow.apache.org/docs/format/FlightSql.html).
Later, you'll add `flightsql-dbapi` to Superset's Docker configuration.
> [!Warning]
> The `flightsql-dbapi` library is experimental and under active development.
> The APIs it provides could change at any time.
4. Use Git to clone the Apache Superset repository:
```sh
git clone https://github.com/apache/superset.git
```
The repository contains Superset code and configuration files for running Superset in Docker containers.
Change to your superset repository directory:
cd ./superset
In your text editor or terminal, create the file ./docker/requirements-local.txt and append the line flightsql-dbapi--for example:
cat <<EOF >./docker/requirements-local.txt
flightsql-dbapi
EOF
The ./docker/requirements-local.txt file is used to specify additional Python packages that Docker should include for Superset.
For more information about Superset's Docker configuration, see Getting Started with Superset using Docker.
Use the docker-compose pull command to fetch dependencies for the Docker containers.
docker compose -f docker-compose-non-dev.yml pull
The process might take several seconds to complete. After it completes, you're ready to Start the Superset Docker containers.
To start the containers and run Superset, enter the docker-compose up command and pass the -f flag with the setup file name:
docker compose -f docker-compose-non-dev.yml up
This might take several seconds to complete.
If successful, the terminal contains output similar to the following:
superset_init | Init Step 4/4 [Complete] -- Loading examples
superset_init |
superset_init |
superset_init | ######################################################################
superset_init |
superset_init exited with code 0
superset_app | 127.0.0.1 - - [24/Mar/2023:15:14:11 +0000] "GET /health HTTP/1.1" 200 2 "-" "curl/7.74.0"
With Superset running, you're ready to log in and set up a database connection.
In a browser, visit localhost:8088 to log in to the Superset user interface (UI). If you configured Superset to use a custom domain, navigate to your custom domain.
If this is your first time logging into Superset, use the following username and password:
Optional: Create an admin user with a unique password.
In the Superset UI, click Settings in the top right and select Database Connections.
Click + Database in the top right.
In the Connect a Database window, click on the Supported Databases drop-down menu and select Other.
{{< img-hd src="/img/influxdb3/cloud-serverless-superset-connect.png" alt="Configure InfluxDB connection in Superset" />}}
Enter a Display Name (for example, InfluxDB Cloud Dedicated) for the database connection.
Enter your SQL Alchemy URI comprised of the following:
datafusion+flightsqlQuery parameters
?database: URL-encoded InfluxDB database name?token: InfluxDB API token with READ access to the specified database{{< code-callout "<(domain|port|database-name|token)>" >}} {{< code-callout "cluster-id.influxdb.io|443|example-database|example-token" >}}
# Syntax
datafusion+flightsql://<domain>:<port>?database=<database-name>&token=<token>
# Example
datafusion+flightsql://{{< influxdb/host >}}:443?database=example-database&token=example-token
{{< /code-callout >}} {{< /code-callout >}}
With a connection to InfluxDB {{< current-version >}} established, you can begin to query and visualize data from InfluxDB.
In the Superset UI, click SQL ▾ in the top navigation bar and select SQL Lab.
In the left pane:
The measurement schema appears in the left pane:
{{< img-hd src="/img/influxdb3/cloud-serverless-superset-schema.png" alt="Select your InfluxDB schema in Superset" />}}
Use the query editor to write an SQL query that queries data in your InfluxDB database.
Click Run to execute the query.
Query results appear below the query editor.
Use Superset to create visualizations and dashboards for InfluxDB queries. For a comprehensive walk-through of creating visualizations with Superset, see the Creating Charts and Dashboards in Superset documentation.
{{< img-hd src="/img/influxdb3/cloud-serverless-superset-dashboard.png" alt="Build InfluxDB dashboards in Apache Superset" />}}