Installation Guide
Relevant source files
The following files were used as context for generating this wiki page:
The superset-ext project is a Meltano utility extension designed to wrap and manage Apache Superset within a Meltano project. This installation guide details the process of adding the extension as a utility, configuring the necessary environment, and initializing the Superset metadata database and administrative accounts.
The extension leverages the Meltano Extension Developer Kit (EDK) to provide a standardized interface for common tasks such as configuration file generation (superset_config.py), database upgrades, and admin user creation.
Sources: README.md:1-5, superset_ext/extension.py:27-30, pyproject.toml:1-15
Prerequisites
Before installing the extension, ensure the following dependencies are met:
- Python Version: The project requires Python
<3.11,>=3.7. - Meltano: The extension is designed to be installed as a Meltano utility.
- Core Dependencies: The extension relies on
structlog,PyYAML,pydantic,click, andtyper.
Sources: pyproject.toml:11-17
Installation Steps
Installation is performed via the Meltano CLI. Note that installing the apache-superset package via pip can take approximately 10 minutes.
1. Add Utility to Meltano
Execute the following command to install the extension as a utility:
meltano install utility superset_ext
Sources: README.md:43-44
2. Configure Secret Key
Superset requires a SECRET_KEY for cryptographic signing.
meltano config superset_ext set SECRET_KEY $(openssl rand -base64 42)
Sources: README.md:46-47
3. Initialize the Extension
The initialization process generates the configuration file and prepares the database.
meltano invoke superset_ext:initialize
Sources: README.md:49-50
4. Create Admin User
You can create an admin user interactively or via command-line flags.
# Interactive mode
meltano invoke superset_ext:create-admin
# Flags mode
meltano invoke superset_ext:create-admin --username=admin --firstname=admin --lastname=admin --email=admin@admin --password=password
Sources: README.md:52-55
Initialization Logic
The initialize command performs a series of sequential tasks to prepare the Superset environment. This logic is handled by the Superset.initialize() method in the extension logic.
The flow diagram illustrates the automated sequence triggered by the initialize command.
Initialization Sequence Details
- Config Generation: The extension writes a
superset_config.pyto the path defined bySUPERSET_CONFIG_PATH(defaults toanalyze/superset/superset_config.py). - Database Migration: Executes
superset db upgradeto initialize or update the metadata schema. - App Initialization: Executes
superset initto set up default roles and permissions. - Permissions Sync: Executes
superset fab create-permissionsto ensure the Flask AppBuilder permissions are synchronized.
Sources: superset_ext/extension.py:53-100, superset_ext/utils.py:112-140
Configuration Options
The extension maps environment variables with the SUPERSET_ prefix to Superset configuration options. It also sets critical default paths within the Meltano project structure.
| Option | Default Value | Description |
|---|---|---|
SUPERSET_HOME | $MELTANO_PROJECT_ROOT/.meltano/utilities/superset | Storage for Superset assets and DB |
SUPERSET_CONFIG_PATH | $MELTANO_PROJECT_ROOT/analyze/superset/superset_config.py | Location of generated config file |
SQLALCHEMY_DATABASE_URI | sqlite:///{SUPERSET_HOME}/superset.db | URI for the metadata database |
FLASK_APP | superset | The Flask application entry point |
Sources: superset_ext/utils.py:65-98, README.md:27-31
CLI Invokers
The project defines two primary scripts in pyproject.toml that handle different execution modes:
This diagram shows the routing between the specialized extension commands and the general CLI pass-through.
- superset_extension: Used for managed commands like
initialize,create-admin, anddescribe. It uses thetyperapp defined inmain.py. - superset_invoker: A pass-through shim that allows direct execution of any standard
supersetCLI command (e.g.,superset version) with the extension's environment context.
Sources: pyproject.toml:50-52, superset_ext/main.py:20-25, superset_ext/pass_through.py:11-18
Summary
The installation of superset-ext integrates Apache Superset into the Meltano ecosystem by automating configuration and database management. By following the standard install, initialize, and create-admin workflow, users can deploy a pre-configured Superset instance that respects the Meltano project's file structure and environment settings.