Joe Li 1bc20f2206 fix(subdirectory): lift get_redirect_url helper + harden against AF-2/AF-3 (Slice 4)
Lifts `Superset.get_redirect_url` out of `views/core.py` into a module-level
`get_explore_redirect_url() -> str | None` in `views/utils.py`. Both surviving
callers (`ExploreView.root` in `views/explore.py` and the deprecated
`Superset.explore` GET branch in `views/core.py`) call the shared helper and
redirect only when it returns a URL — closing the typed-entry
`/explore/<dst>/<int:dsid>/` GET loop that the previous `isinstance(dict)`
gate missed on cache failure.

Closes:
- nit-2 (real duplication): the `?form_data=` parse-and-redirect logic is now
  a single function with one set of guards.
- AF-2 (malformed datasource): `datasource.split("__")` len!=2 and invalid
  `DatasourceType(...)` enum both fall through to SPA (HEAD raised 500).
- AF-3 (non-numeric slice_id): `request.args.get("slice_id", type=int)`
  returns None on parse failure (HEAD raised `ValueError` from eager `int()`).
- Cache-write loop guard: narrow `try/except ValueError` around
  `CreateFormDataCommand.run` falls through to SPA on cache failure.
- `(endpoint, sorted query items)` loop guard: if the would-be redirect
  target matches the current request, render SPA instead of 302-looping.

Precedence preserved (round-6 pin): form_data `slice_id` wins over query
`slice_id`; only consults query when form_data omits it.

Pinned-callers invariant: `test_get_explore_redirect_url_sanctioned_callers`
greps `superset/` for `get_explore_redirect_url(` and asserts the caller set
is exactly `{superset/views/explore.py, superset/views/core.py}`. A fourth
caller fails CI until the test (and PLAN.md Slice 5 sanction list) update.

CreateFormDataCommand/CommandParameters are imported inside the helper body
(not at module top-level) to break a circular import: `views/utils.py` is
transitively imported by `commands/base.py`'s dependency graph, so a top-
level import loops back through this file before init finishes. Matches the
prior inline `from superset.views.core import Superset` pattern.

M2 follow-up: CodeQL re-scan after merge should cover `views/utils.py` (new
helper site) in addition to the surviving `redirect()` sinks at
`explore.py:47` + `core.py:436`. The mitigation remains the server-derived
`url_for("ExploreView.root")` target (C1).

Tests: 13 new tests under `tests/integration_tests/views/test_explore_redirect.py`
(one is the sanctioned-callers static-source assertion; the other 12 pin
behaviour through `self.client.get`). Existing `test_explore_redirect` and
`test_explore_no_datasource_renders_spa` in `core_tests.py` stay green
(behaviour-equivalent through the lift). Pre-commit (auto-walrus + mypy
+ ruff-format + ruff + pylint + blacklist + license headers) clean.

Local-env validation note: this worktree's docker-light stack lacks a
working `/login/` POST route (`SupersetAuthView.login` only handles GET;
`AuthDBView.login` POST 404s) — `tests/integration_tests/test_app.py::login`
cannot authenticate, which fails any SupersetTestCase that hits a permission-
gated endpoint (including the pre-existing `test_redirect_view.py` baseline).
The static-scan test passes locally; the other 12 behaviour tests are
validated by CI's properly-configured integration stack.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 14:26:31 -07:00
2025-12-04 13:18:34 -05:00

Superset

License Latest Release on Github Build Status PyPI version PyPI GitHub Stars Contributors Last Commit Open Issues Open PRs Get on Slack Documentation

Superset logo (light)

A modern, enterprise-ready business intelligence web application.

Documentation

  • User Guide — For analysts and business users. Explore data, build charts, create dashboards, and connect databases.
  • Administrator Guide — Install, configure, and operate Superset. Covers security, scaling, and database drivers.
  • Developer Guide — Contribute to Superset or build on its REST API and extension framework.

Why Superset? | Supported Databases | Release Notes | Get Involved | Resources | Organizations Using Superset

Why Superset?

Superset is a modern data exploration and data visualization platform. Superset can replace or augment proprietary business intelligence tools for many teams. Superset integrates well with a variety of data sources.

Superset provides:

  • A no-code interface for building charts quickly
  • A powerful, web-based SQL Editor for advanced querying
  • A lightweight semantic layer for quickly defining custom dimensions and metrics
  • Out of the box support for nearly any SQL database or data engine
  • A wide array of beautiful visualizations to showcase your data, ranging from simple bar charts to geospatial visualizations
  • Lightweight, configurable caching layer to help ease database load
  • Highly extensible security roles and authentication options
  • An API for programmatic customization
  • A cloud-native architecture designed from the ground up for scale

Screenshots & Gifs

Video Overview

superset-video-1080p.webm


Large Gallery of Visualizations


Craft Beautiful, Dynamic Dashboards


No-Code Chart Builder


Powerful SQL Editor


Supported Databases

Superset can query data from any SQL-speaking datastore or data engine (Presto, Trino, Athena, and more) that has a Python DB-API driver and a SQLAlchemy dialect.

Here are some of the major database solutions that are supported:

Amazon Athena   Amazon DynamoDB   Amazon Redshift   Apache Doris   Apache Drill   Apache Druid   Apache Hive   Apache Impala   Apache Kylin   Apache Pinot   Apache Solr   Apache Spark SQL   Ascend   Aurora MySQL (Data API)   Aurora PostgreSQL (Data API)   Azure Data Explorer   Azure Synapse   ClickHouse   Cloudflare D1   CockroachDB   Couchbase   CrateDB   Databend   Databricks   Denodo   Dremio   DuckDB   Elasticsearch   Exasol   Firebird   Firebolt   Google BigQuery   Google Sheets   Greenplum   Hologres   IBM Db2   IBM Netezza Performance Server   MariaDB   Microsoft SQL Server   MonetDB   MongoDB   MotherDuck   OceanBase   Oracle   Presto   RisingWave   SAP HANA   SAP Sybase   Shillelagh   SingleStore   Snowflake   SQLite   StarRocks   Superset meta database   TDengine   Teradata   TimescaleDB   Trino   Vertica   YDB   YugabyteDB

A more comprehensive list of supported databases along with the configuration instructions can be found here.

Want to add support for your datastore or data engine? Read more here about the technical requirements.

Installation and Configuration

Try out Superset's quickstart guide or learn about the options for production deployments.

Get Involved

Contributor Guide

Interested in contributing? Check out our Developer Guide to find resources around contributing along with a detailed guide on how to set up a development environment.

Resources

Understanding the Superset Points of View

Repo Activity

Performance Stats of apache/superset - Last 28 days
Languages
Python 38%
TypeScript 37.7%
Jupyter Notebook 21.3%
HTML 2.4%
JavaScript 0.3%
Other 0.2%