TVL Managed Superset

Apache Superset CLI: Automate Deployments 2026

Apache Superset CLI guide: init, db upgrade, fab create-admin, export-dashboards commands. Automation and CI/CD.

The Apache Superset CLI is an essential tool for administration and automation. It allows initializing an instance, managing users, exporting dashboards, and much more, without going through the UI. This guide covers essential commands in 2026.

1. CLI access

Depending on deployment mode:

  • Docker: docker exec -it superset_app superset <cmd>;
  • Kubernetes: kubectl exec -it deploy/superset -- superset <cmd>;
  • Local Python: superset <cmd>.

If you want a Superset without CLI access to manage, TVL Managed Superset automatically executes these commands on each deployment.

2. Initialization commands

# Metadata DB migrations
superset db upgrade

# Initialization of default roles and permissions
superset init

# Admin creation
superset fab create-admin \
  --username admin \
  --firstname Admin --lastname User \
  --email admin@example.com \
  --password 'XXX'

These three commands are necessary on a new instance.

3. User management

# List users
superset fab list-users

# List roles
superset fab list-roles

# Reset a user's password
superset fab reset-password --username admin

# Delete a user
superset fab delete-user --username old.user

4. Export and import dashboards

# Export a dashboard
superset export-dashboards -d 42 -f /tmp/dashboard_42.yaml

# Export all dashboards
superset export-dashboards -f /tmp/dashboards.yaml

# Import a dashboard
superset import-dashboards -p /tmp/dashboard_42.yaml -u admin

Ideal for versioning dashboards in Git and deploying in CI/CD.

5. Datasets and databases

# Create a DB connection by script (alternative to UI)
superset set-database-uri --database_name my_db \
  --uri 'postgresql+psycopg2://...'

# Refresh datasets (resync columns)
superset refresh-druid-datasource

# Re-encrypt secrets after SECRET_KEY rotation
superset re-encrypt-secrets

This configuration is applied by default on TVL Managed Superset, which follows community best practices.

6. Examples loaders

# Load example data (for demo)
superset load-examples

# Clear cache
superset clear-cache

7. CI/CD patterns

Typical pipeline to deploy a Superset environment:

  1. Build custom Docker image (drivers, configuration);
  2. Helm upgrade with init job that runs superset db upgrade && superset init;
  3. Import dashboards from Git via superset import-dashboards;
  4. Smoke test via REST API.

8. Best practices

  • Idempotence: db upgrade and init commands can be re-run without risk;
  • No password in CLI in production: use K8s secrets, not --password;
  • Versioning: commit dashboard YAMLs in Git;
  • Audit: log all sensitive commands on infra side.

9. Common pitfalls

  • FLASK_APP not defined: CLI doesn't find the app, add export FLASK_APP=superset;
  • Missing DB connection: CLI requires SQLALCHEMY_DATABASE_URI in environment;
  • Permissions: CLI runs with the Linux user, not a Superset user;
  • Stuck migrations: if a migration fails, superset db downgrade to roll back.

10. Conclusion

The Superset CLI is an indispensable companion to any serious administration. Combined with the REST API and a CI/CD pipeline, it fully industrializes deployment, user management, and dashboard portability.

Want the benefits of Apache Superset without the friction of installation and maintenance? Deploy your instance in 3 clicks with TVL Managed Superset, hosted in Europe (OVHcloud, Roubaix, France).

For more: Superset REST API, dashboard export, updates.