# Apache Superset BI Platform

> Apache Superset for data exploration and visualization with Redis and PostgreSQL.

- Category: Database Stacks
- Difficulty: intermediate
- Components: superset, postgresql, redis
- Tags: superset, bi, analytics, dashboard, visualization
- Source: https://docker.recipes/databases/superset-bi-platform

## Overview

Apache Superset is a modern, enterprise-ready business intelligence web application that enables data exploration and visualization at scale. Originally developed by Airbnb and now an Apache Software Foundation project, Superset provides a rich set of data visualizations, an intuitive interface for exploring and visualizing datasets, and enterprise-grade authentication with integration to major authentication providers. It supports dozens of databases out of the box and can handle datasets of any size through its SQL Lab interface and visualization builder.

This stack combines Superset with PostgreSQL as the metadata database and Redis for caching and session management. PostgreSQL stores Superset's application metadata, user permissions, dashboard configurations, and query results, while Redis accelerates performance by caching database queries, storing user sessions, and managing Celery task queues for asynchronous operations. This architecture ensures Superset can handle concurrent users efficiently while maintaining fast dashboard load times and responsive data exploration.

Data teams, business analysts, and organizations seeking to democratize data access will benefit from this deployment. The PostgreSQL backend provides ACID compliance and reliability for storing critical dashboard configurations and user management data, while Redis ensures sub-millisecond response times for cached queries and session data. This combination is ideal for companies transitioning from proprietary BI tools like Tableau or PowerBI to open-source alternatives, or organizations building their first comprehensive data visualization platform.

## Features

- Rich visualization library with 40+ chart types including time-series, geospatial maps, and custom D3.js visualizations
- SQL Lab interface for advanced data exploration with syntax highlighting, query history, and result export capabilities
- Role-based access control with row-level security and column-level permissions for enterprise data governance
- PostgreSQL metadata store ensuring ACID compliance for dashboard configurations and user management data
- Redis-powered query result caching reducing database load and improving dashboard performance by up to 90%
- Native database connectivity supporting 30+ data sources including Snowflake, BigQuery, MySQL, and Elasticsearch
- Drag-and-drop dashboard builder with responsive layouts and embedded analytics capabilities
- Asynchronous query execution using Redis-backed Celery queues for handling long-running analytical queries

## Use cases

- Business intelligence platform for mid-size companies replacing expensive proprietary tools like Tableau or QlikView
- Self-service analytics environment enabling non-technical users to create dashboards from existing data warehouses
- Data exploration hub for data science teams analyzing large datasets stored in cloud data warehouses
- Executive reporting system displaying KPIs and business metrics with automated refresh schedules
- Customer-facing embedded analytics for SaaS applications requiring white-label dashboard functionality
- Financial reporting and compliance dashboards with role-based access for different organizational levels
- Marketing analytics platform connecting to Google Analytics, Facebook Ads, and CRM systems for unified reporting

## Prerequisites

- Minimum 4GB RAM recommended (2GB for Superset, 1GB for PostgreSQL, 512MB for Redis)
- Port 8088 available for Superset web interface access
- Docker Engine 20.10+ and Docker Compose 2.0+ for container orchestration
- Basic SQL knowledge for connecting data sources and creating custom queries in SQL Lab
- Understanding of your target database connection parameters (host, port, credentials) for data source configuration
- 10GB+ available disk space for PostgreSQL metadata storage and Redis persistence

## docker-compose.yml

```yaml
services:
  postgres:
    image: postgres:16-alpine
    container_name: superset-postgres
    restart: unless-stopped
    environment:
      POSTGRES_USER: ${POSTGRES_USER:-superset}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-superset}
      POSTGRES_DB: ${POSTGRES_DB:-superset}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      - superset-network

  redis:
    image: redis:alpine
    container_name: superset-redis
    restart: unless-stopped
    volumes:
      - redis_data:/data
    networks:
      - superset-network

  superset:
    image: apache/superset:latest
    container_name: superset
    restart: unless-stopped
    ports:
      - "${SUPERSET_PORT:-8088}:8088"
    environment:
      SUPERSET_SECRET_KEY: ${SUPERSET_SECRET_KEY:-changeme}
      DATABASE_URL: postgresql://${POSTGRES_USER:-superset}:${POSTGRES_PASSWORD:-superset}@postgres:5432/${POSTGRES_DB:-superset}
      REDIS_URL: redis://redis:6379/0
    depends_on:
      - postgres
      - redis
    networks:
      - superset-network

volumes:
  postgres_data:
  redis_data:

networks:
  superset-network:
    driver: bridge
```

## .env

```bash
# Apache Superset
SUPERSET_PORT=8088
SUPERSET_SECRET_KEY=your-secret-key-change-me
POSTGRES_USER=superset
POSTGRES_PASSWORD=superset
POSTGRES_DB=superset
```

## Usage notes

- Superset at http://localhost:8088
- Initialize: docker exec superset superset-init
- Create admin: superset fab create-admin
- Connect databases via UI

## Troubleshooting

- Superset fails to start with 'database connection error': Run docker exec superset superset db upgrade to initialize the PostgreSQL metadata database schema
- Login page shows 'Invalid login credentials' after setup: Execute docker exec -it superset superset fab create-admin to create the initial admin user account
- Dashboards load slowly or timeout: Increase Redis memory allocation and verify Redis connectivity with docker exec superset-redis redis-cli ping
- PostgreSQL connection refused errors: Check that POSTGRES_USER and POSTGRES_PASSWORD environment variables match between postgres and superset services
- Superset shows blank page or JavaScript errors: Clear browser cache and ensure SUPERSET_SECRET_KEY environment variable is set to a secure random string
- Query results not caching properly: Verify Redis service health and check Superset cache configuration in superset_config.py for proper Redis URL format

