A modern, enterprise-ready business intelligence web application for data exploration and visualization.
npx @tessl/cli install tessl/pypi-apache-superset@1.0.0Apache Superset is a modern, enterprise-ready business intelligence web application that enables data exploration and visualization. Built with Python and React, it provides rich visualizations, interactive dashboards, SQL Lab for data analysis, and enterprise-grade security features.
pip install apache-supersetimport superset
from superset import app, db, cache, security_managerApplication factory pattern:
from superset.app import create_app
app = create_app()# Initialize Superset application
from superset.app import create_app
# Create app instance
app = create_app()
# Initialize database and permissions
with app.app_context():
from superset import cli
cli.init()
# Run development server
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=8088)Command-line usage:
# Initialize Superset
superset init
# Create admin user
superset fab create-admin
# Load example data
superset load-examples
# Run development server
superset run -h 0.0.0.0 -p 8088 --with-threads --reload --debuggerApache Superset follows a layered architecture:
Comprehensive CLI for application management, data loading, user administration, and development tasks.
def superset() -> None:
"""Management script for the Superset application."""
def init() -> None:
"""Initialize the Superset application."""
def version(verbose: bool) -> None:
"""Print current version number."""
def load_examples() -> None:
"""Load example data and dashboards."""Full REST API for programmatic access to dashboards, charts, datasets, and administrative functions.
# Chart API endpoints
class ChartRestApi(BaseSupersetModelRestApi):
def get(self, pk: int) -> Response:
"""Get chart by ID."""
def post(self) -> Response:
"""Create new chart."""
def put(self, pk: int) -> Response:
"""Update chart."""
def delete(self, pk: int) -> Response:
"""Delete chart."""
# Dashboard API endpoints
class DashboardRestApi(BaseSupersetModelRestApi):
def get(self, pk: int) -> Response:
"""Get dashboard by ID."""
def export(self) -> Response:
"""Export dashboards."""Comprehensive configuration system for databases, security, caching, and feature flags.
# Core configuration classes
class SupersetConfig:
SECRET_KEY: str
SQLALCHEMY_DATABASE_URI: str
WTF_CSRF_ENABLED: bool
FEATURE_FLAGS: Dict[str, bool]
# Database configuration
DATABASES: Dict[str, Dict[str, Any]]
# Cache configuration
CACHE_CONFIG: Dict[str, Any]
DATA_CACHE_CONFIG: Dict[str, Any]
# Security configuration
CUSTOM_SECURITY_MANAGER: Optional[Type[SupersetSecurityManager]]
AUTH_TYPE: int
AUTH_ROLE_ADMIN: str
AUTH_ROLE_PUBLIC: strSQLAlchemy-based models for dashboards, charts, datasets, users, and metadata management.
# Core models
class Dashboard(Model, AuditMixinNullable):
id: int
dashboard_title: str
position_json: str
slices: List[Slice]
class Slice(Model, AuditMixinNullable):
id: int
slice_name: str
viz_type: str
params: str
datasource: BaseDatasource
class Database(Model, AuditMixinNullable):
id: int
database_name: str
sqlalchemy_uri: str
engine: strEnterprise-grade security with role-based access control, row-level security, and OAuth integration.
class SupersetSecurityManager(SecurityManager):
def get_user_menu_access(self, menu_names: List[str]) -> Set[str]:
"""Get user's menu access permissions."""
def can_access(self, permission_name: str, view_name: str) -> bool:
"""Check if user has permission."""
def get_rls_filters(self, table: BaseDatasource) -> List[SqlaQuery]:
"""Get row-level security filters."""
# Permission model
class Permission(Model):
name: str
view_menu: ViewMenu
# Role model
class Role(Model):
name: str
permissions: List[Permission]Extensible visualization system with 40+ chart types and custom plugin support.
class BaseViz:
viz_type: str
verbose_name: str
is_timeseries: bool
def get_query_object(self) -> QueryObject:
"""Build query object from form data."""
def get_data(self, df: pd.DataFrame) -> VizData:
"""Process data for visualization."""
# Chart plugin registry
viz_types: Dict[str, Type[BaseViz]]
# Query object for data retrieval
class QueryObject:
datasource: BaseDatasource
metrics: List[str]
groupby: List[str]
filters: List[Dict[str, Any]]# Core application types
from typing import Dict, List, Optional, Any, Union
from flask import Flask
from pandas import DataFrame
# Configuration types
ConfigDict = Dict[str, Any]
FeatureFlags = Dict[str, bool]
# Data types
VizData = Dict[str, Any]
QueryResult = Dict[str, Any]
ChartData = Dict[str, Any]
# Security types
Permission = str
Role = str
User = Dict[str, Any]
# Database types
DatabaseEngine = str
ConnectionString = str
QueryObject = Dict[str, Any]