Documentation

Use Superset to query and visualize data

Use Apache Superset to query and visualize data stored in an InfluxDB database.

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.

Apache Superset documentation

Set up Docker for Superset and Flight SQL

Install prerequisites for Superset and Flight SQL

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:

Superset is not officially supported on Windows. For more information about running Superset with Windows and Docker, see the Superset documentation.

  1. Follow the instructions to download and install Docker and docker-compose for your system:

  2. Follow the Python.org Downloading Python instructions for your system.

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

    python --version
    
    pip --version
    
    python3 --version
    
    pip3 --version
    

    If neither pip nor pip3 works, follow one of the Pypa.io Pip Installation methods for your system.

  4. Use Pip to install the flightsql-dbapi library.

    pip install flightsql-dbapi
    
    pip3 install flightsql-dbapi
    

    The flightsql-dbapi library for Python provides a DB API 2 interface and SQLAlchemy dialect for Flight SQL. Later, you’ll add flightsql-dbapi to Superset’s Docker configuration.

    The flightsql-dbapi library is experimental and under active development. The APIs it provides could change at any time.

  5. Use Git to clone the Apache Superset repository:

    git clone https://github.com/apache/superset.git
    

    The repository contains Superset code and configuration files for running Superset in Docker containers.

Set up Docker for Superset

  1. Change to your superset repository directory:

    cd ./superset
    
  2. 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.

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

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.

Log in to Superset

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

  2. If this is your first time logging into Superset, use the following username and password:

    • Username: admin
    • Password: admin
  3. Optional: Create a new admin user with a unique password.

    1. In the Superset UI, click Settings in the top right and select List Users.
    2. Click in the top right.
    3. Select the Admin role and provide the remaining credentials for the new user.
    4. Click Save.
    5. Delete the default admin users.

Create a database connection for InfluxDB

  1. In the Superset UI, click Settings in the top right and select Database Connections.

  2. Click + Database in the top right.

  3. In the Connect a Database window, click on the Supported Databases drop-down menu and select Other.

    Configure InfluxDB connection in Superset
  4. Enter a Display Name (for example, InfluxDB Clustered) for the database connection.

  5. Enter your SQL Alchemy URI comprised of the following:

    • Protocol: datafusion+flightsql
    • Domain: InfluxDB cluster URL
    • Port: 443

    Query parameters

    • ?database: URL-encoded InfluxDB database name
    • ?token: InfluxDB API token with READ access to the specified database
    # Syntax
    datafusion+flightsql://<domain>:<port>?database=<database-name>&token=<token>
    
    # Example
    datafusion+flightsql://cluster-host.com:443?database=example-database&token=example-token
    
  6. Click Test Connection to ensure the connection works.

  7. Click Connect to save the database connection.

Query InfluxDB with Superset

With a connection to InfluxDB Clustered established, you can begin to query and visualize data from InfluxDB.

  1. In the Superset UI, click SQL ▾ in the top navigation bar and select SQL Lab.

  2. In the left pane:

    1. Under Database, select your InfluxDB connection.
    2. Under Schema, select iox.
    3. Under See table schema, select the InfluxDB measurement to query.

    The measurement schema appears in the left pane:

    Select your InfluxDB schema in Superset
  3. Use the query editor to write an SQL query that queries data in your InfluxDB database.

  4. Click Run to execute the query.

Query results appear below the query editor.

Build visualizations with Superset

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.

Build InfluxDB dashboards in Apache Superset

Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

InfluxDB v3 enhancements and InfluxDB Clustered is now generally available

New capabilities, including faster query performance and management tooling advance the InfluxDB v3 product line. InfluxDB Clustered is now generally available.

InfluxDB v3 performance and features

The InfluxDB v3 product line has seen significant enhancements in query performance and has made new management tooling available. These enhancements include an operational dashboard to monitor the health of your InfluxDB cluster, single sign-on (SSO) support in InfluxDB Cloud Dedicated, and new management APIs for tokens and databases.

Learn about the new v3 enhancements


InfluxDB Clustered general availability

InfluxDB Clustered is now generally available and gives you the power of InfluxDB v3 in your self-managed stack.

Talk to us about InfluxDB Clustered