Compare commits

..

1 Commits

Author SHA1 Message Date
Evan
c32284d56a chore(ci): correct setup-python pin comment to match v6.2.0
The pinned SHA a309ff8 resolves to tag v6.2.0, but the inline comment
read "# v6", which zizmor flags as a ref-version-mismatch. Update the
comment to the precise version, matching the rest of the workflows that
use full semver in their pin comments.

Resolves code-scanning alert #2550

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-24 00:56:35 -07:00
956 changed files with 45270 additions and 86890 deletions

16
.github/CODEOWNERS vendored
View File

@@ -1,5 +1,7 @@
# Notify all committers of DB migration changes, per SIP-59 # Notify all committers of DB migration changes, per SIP-59
# https://github.com/apache/superset/issues/13351
/superset/migrations/ @mistercrunch @michael-s-molina @betodealmeida @eschutho @sadpandajoe /superset/migrations/ @mistercrunch @michael-s-molina @betodealmeida @eschutho @sadpandajoe
# Notify some committers of changes in the components # Notify some committers of changes in the components
@@ -10,35 +12,33 @@
# Notify Helm Chart maintainers about changes in it # Notify Helm Chart maintainers about changes in it
/helm/superset/ @dpgaspar @villebro @nytai @michael-s-molina @mistercrunch @rusackas @Antonio-RiveroMartnez @hainenber /helm/superset/ @craig-rueda @dpgaspar @villebro @nytai @michael-s-molina @mistercrunch @rusackas @Antonio-RiveroMartnez
# Notify E2E test maintainers of changes # Notify E2E test maintainers of changes
/superset-frontend/playwright/ @sadpandajoe @geido @eschutho @rusackas @mistercrunch /superset-frontend/cypress-base/ @sadpandajoe @geido @eschutho @rusackas @betodealmeida @mistercrunch
/superset-frontend/cypress-base/ @sadpandajoe @geido @eschutho @rusackas @mistercrunch
# Notify PMC members of changes to GitHub Actions # Notify PMC members of changes to GitHub Actions
/.github/ @villebro @geido @eschutho @rusackas @betodealmeida @nytai @mistercrunch @kgabryje @sha174n @dpgaspar @sadpandajoe @hainenber /.github/ @villebro @geido @eschutho @rusackas @betodealmeida @nytai @mistercrunch @craig-rueda @kgabryje @dpgaspar @sadpandajoe @hainenber
# Notify PMC members of changes to CI-executed scripts (supply-chain risk: # Notify PMC members of changes to CI-executed scripts (supply-chain risk:
# scripts/ files run directly in CI workflows and can execute arbitrary code) # scripts/ files run directly in CI workflows and can execute arbitrary code)
/scripts/ @villebro @geido @eschutho @rusackas @betodealmeida @nytai @mistercrunch @kgabryje @dpgaspar @sha174n @sadpandajoe @hainenber /scripts/ @villebro @geido @eschutho @rusackas @betodealmeida @nytai @mistercrunch @craig-rueda @kgabryje @dpgaspar @sadpandajoe @hainenber
# Notify PMC members of changes to required GitHub Actions # Notify PMC members of changes to required GitHub Actions
/.asf.yaml @villebro @geido @eschutho @rusackas @betodealmeida @nytai @mistercrunch @kgabryje @dpgaspar @sha174n @Antonio-RiveroMartnez /.asf.yaml @villebro @geido @eschutho @rusackas @betodealmeida @nytai @mistercrunch @craig-rueda @kgabryje @dpgaspar @Antonio-RiveroMartnez
# Maps are a finicky contribution process we care about # Maps are a finicky contribution process we care about
**/*.geojson @villebro @rusackas **/*.geojson @villebro @rusackas
**/*.ipynb @villebro @rusackas
/superset-frontend/plugins/legacy-plugin-chart-country-map/ @villebro @rusackas /superset-frontend/plugins/legacy-plugin-chart-country-map/ @villebro @rusackas
# Notify translation maintainers of changes to translations # Notify translation maintainers of changes to translations
/superset/translations/ @sfirke @rusackas @villebro @sadpandajoe @hainenber /superset/translations/ @sfirke @rusackas
# Notify PMC members of changes to extension-related files # Notify PMC members of changes to extension-related files

View File

@@ -42,7 +42,7 @@ runs:
fi fi
echo "python-version=$RESOLVED_VERSION" >> "$GITHUB_OUTPUT" echo "python-version=$RESOLVED_VERSION" >> "$GITHUB_OUTPUT"
- name: Set up Python ${{ steps.set-python-version.outputs.python-version }} - name: Set up Python ${{ steps.set-python-version.outputs.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with: with:
python-version: ${{ steps.set-python-version.outputs.python-version }} python-version: ${{ steps.set-python-version.outputs.python-version }}
cache: ${{ inputs.cache }} cache: ${{ inputs.cache }}

View File

@@ -17,7 +17,6 @@ runs:
- name: Install supersetbot from npm - name: Install supersetbot from npm
if: ${{ inputs.from-npm == 'true' }} if: ${{ inputs.from-npm == 'true' }}
shell: bash shell: bash
# zizmor: ignore[adhoc-packages] - supersetbot is a first-party Apache CLI (apache-superset/supersetbot) installed globally as a tool; a global CLI install has no application manifest/lockfile context
run: npm install -g supersetbot run: npm install -g supersetbot
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
@@ -32,7 +31,6 @@ runs:
if: ${{ inputs.from-npm == 'false' }} if: ${{ inputs.from-npm == 'false' }}
shell: bash shell: bash
working-directory: supersetbot working-directory: supersetbot
# zizmor: ignore[adhoc-packages] - installs the locally packed supersetbot tarball built from the trusted apache-superset/supersetbot checkout; no lockfile applies to a global CLI install
run: | run: |
# simple trick to install globally with dependencies # simple trick to install globally with dependencies
npm pack npm pack

View File

@@ -32,13 +32,6 @@ updates:
# and confirm the issue https://github.com/apache/superset/issues/39600 is fixed # and confirm the issue https://github.com/apache/superset/issues/39600 is fixed
- dependency-name: "react-checkbox-tree" - dependency-name: "react-checkbox-tree"
update-types: ["version-update:semver-major"] update-types: ["version-update:semver-major"]
# Babel 8 (7.x -> 8.x) is blocked on the surrounding ecosystem: @emotion/babel-plugin
# (NodePath#hoist), babel-plugin-jsx-remove-data-test-id (t.jSXOpeningElement), and
# ts-jest all rely on Babel APIs removed in v8 and have not shipped Babel 8 support.
# Ignore the coordinated major bump until the ecosystem catches up; it must be done
# as a single manual upgrade anyway. TODO: remove when Babel 8 support is viable.
- dependency-name: "@babel/*"
update-types: ["version-update:semver-major"]
directory: "/superset-frontend/" directory: "/superset-frontend/"
schedule: schedule:
interval: "daily" interval: "daily"

View File

@@ -40,7 +40,7 @@ jobs:
uses: ./.github/actions/setup-supersetbot/ uses: ./.github/actions/setup-supersetbot/
- name: Set up Python ${{ inputs.python-version }} - name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with: with:
python-version: "3.10" python-version: "3.10"

View File

@@ -64,7 +64,7 @@ jobs:
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2 uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file. # If you wish to specify custom queries, you can do so here or in a config file.
@@ -75,6 +75,6 @@ jobs:
# queries: security-extended,security-and-quality # queries: security-extended,security-and-quality
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2 uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4
with: with:
category: "/language:${{matrix.language}}" category: "/language:${{matrix.language}}"

View File

@@ -37,7 +37,7 @@ jobs:
persist-credentials: false persist-credentials: false
submodules: recursive submodules: recursive
- name: Setup Java - name: Setup Java
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0 uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
with: with:
distribution: "temurin" distribution: "temurin"
java-version: "11" java-version: "11"

View File

@@ -37,13 +37,10 @@ jobs:
node-version: "20" node-version: "20"
- name: Install Dependencies - name: Install Dependencies
# Versions are pinned to avoid ad-hoc, unpinned package installs. run: npm install -g @action-validator/core @action-validator/cli --save-dev
# Bump deliberately when upgrading.
# zizmor: ignore[adhoc-packages] - @action-validator is a global CLI tool installed to validate the repo's workflows; a global CLI install has no application manifest/lockfile context, and the versions are pinned above
run: npm install -g @action-validator/core@0.6.0 @action-validator/cli@0.6.0
- name: Run Script - name: Run Script
run: bash .github/workflows/github-action-validator.sh run: bash .github/workflows/github-action-validator.sh
- name: Check for security issues on GHA workflows - name: Check for security issues on GHA workflows
uses: zizmorcore/zizmor-action@192e21d79ab29983730a13d1382995c2307fbcaa # v0.5.7 uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6

View File

@@ -23,7 +23,7 @@ jobs:
persist-credentials: false persist-credentials: false
submodules: recursive submodules: recursive
- name: Setup Java - name: Setup Java
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0 uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
with: with:
distribution: "temurin" distribution: "temurin"
java-version: "11" java-version: "11"

View File

@@ -32,18 +32,19 @@ jobs:
with: with:
persist-credentials: false persist-credentials: false
submodules: recursive submodules: recursive
- name: Setup Python - name: Setup Python
uses: ./.github/actions/setup-backend/ uses: ./.github/actions/setup-backend/
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Enable brew and helm-docs
- name: Setup Go # Add brew to the path - see https://github.com/actions/runner-images/issues/6283
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 run: |
echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
- name: Install helm-docs eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
run: go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.14.2 echo "HOMEBREW_PREFIX=$HOMEBREW_PREFIX" >>"${GITHUB_ENV}"
echo "HOMEBREW_CELLAR=$HOMEBREW_CELLAR" >>"${GITHUB_ENV}"
echo "HOMEBREW_REPOSITORY=$HOMEBREW_REPOSITORY" >>"${GITHUB_ENV}"
brew install norwoodj/tap/helm-docs
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with: with:
@@ -62,7 +63,7 @@ jobs:
yarn install --immutable yarn install --immutable
- name: Cache pre-commit environments - name: Cache pre-commit environments
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with: with:
path: ~/.cache/pre-commit path: ~/.cache/pre-commit
key: pre-commit-v2-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }} key: pre-commit-v2-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}

View File

@@ -56,7 +56,7 @@ jobs:
- name: Cache npm - name: Cache npm
if: env.HAS_TAGS if: env.HAS_TAGS
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with: with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -70,7 +70,7 @@ jobs:
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- name: Cache npm - name: Cache npm
if: env.HAS_TAGS if: env.HAS_TAGS
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
id: npm-cache # use this to check for `cache-hit` (`steps.npm-cache.outputs.cache-hit != 'true'`) id: npm-cache # use this to check for `cache-hit` (`steps.npm-cache.outputs.cache-hit != 'true'`)
with: with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }} path: ${{ steps.npm-cache-dir-path.outputs.dir }}

View File

@@ -1,177 +0,0 @@
name: Scheduled Docker image refresh
# Re-runs the Docker image build against the latest published release on a
# weekly cadence. The code being built doesn't change — but the base image
# layers (python:*-slim-trixie and its OS packages) DO get upstream
# security patches between Superset releases, and those patches don't
# reach our published images unless we rebuild.
#
# Without this workflow, `apache/superset:<latest>` lags behind upstream
# Debian/Python base patches by whatever interval falls between Superset
# releases (typically 36 weeks). With it, the lag drops to at most one
# week regardless of release cadence.
#
# This is a security-hygiene cron, not a release. It overwrites the
# existing tags for the most recent release (e.g. `apache/superset:5.0.0`
# and `apache/superset:latest`) with bit-for-bit-equivalent contents
# layered on a refreshed base. Image digests change; everything users
# actually pin against (image content, code, deps) does not.
on:
schedule:
# Mondays at 06:00 UTC — gives the weekend for upstream patches to
# settle and surfaces failures at the start of the work week so a
# human can react.
- cron: "0 6 * * 1"
# Manual trigger so operators can force a refresh on demand (e.g.
# immediately after a high-severity base-image CVE drops).
workflow_dispatch: {}
permissions:
contents: read
# Serialize with itself and with the release publisher (tag-release.yml) —
# both push to the same Docker Hub tags, so a race could end with stale
# layers winning. Both workflows must declare this group for the lock to work.
concurrency:
group: docker-publish-latest-release
cancel-in-progress: false
jobs:
config:
runs-on: ubuntu-24.04
outputs:
has-secrets: ${{ steps.check.outputs.has-secrets }}
latest-release: ${{ steps.latest.outputs.tag }}
force-latest: ${{ steps.latest.outputs.force-latest }}
steps:
- name: Check for Docker Hub secrets
id: check
shell: bash
run: |
if [ -n "${DOCKERHUB_USER}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
fi
env:
DOCKERHUB_USER: ${{ (secrets.DOCKERHUB_USER != '' && secrets.DOCKERHUB_TOKEN != '') || '' }}
- name: Look up latest published release
id: latest
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
run: |
# `releases/latest` returns the latest non-prerelease, non-draft
# release — which is exactly what `apache/superset:latest`
# should reflect.
TAG=$(gh api "repos/${REPOSITORY}/releases/latest" --jq .tag_name)
if [ -z "$TAG" ] || [ "$TAG" = "null" ]; then
echo "::error::Could not determine latest release tag"
exit 1
fi
echo "Latest release: $TAG"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
# Only move `:latest` when the release flagged "latest" is also the
# highest semver release. This guards against a mis-click leaving an
# older maintenance release (e.g. a 5.x patch shipped after 6.0 GA)
# marked latest, which would otherwise roll `:latest` back a major
# version on the next cron run. If it isn't the newest, we still
# refresh that release's own version tag but leave `:latest` alone.
HIGHEST=$(gh api --paginate "repos/${REPOSITORY}/releases" \
--jq '.[] | select(.draft|not) | select(.prerelease|not) | .tag_name' \
| sed 's/^v//' | sort -V | tail -n1)
if [ "${TAG#v}" = "$HIGHEST" ]; then
echo "force-latest=1" >> "$GITHUB_OUTPUT"
else
echo "::warning::Latest-flagged release $TAG is not the highest semver ($HIGHEST); refreshing its version tag but leaving :latest untouched"
fi
docker-rebuild:
needs: config
if: needs.config.outputs.has-secrets == '1'
name: docker-rebuild
runs-on: ubuntu-24.04
strategy:
# Mirror the same matrix the release publisher uses so every variant
# operators consume from Docker Hub gets the refreshed base.
matrix:
build_preset: ["dev", "lean", "py310", "websocket", "dockerize", "py311", "py312"]
fail-fast: false
steps:
- name: "Checkout release tag: ${{ needs.config.outputs.latest-release }}"
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ needs.config.outputs.latest-release }}
fetch-depth: 0
persist-credentials: false
- name: Setup Docker Environment
uses: ./.github/actions/setup-docker
with:
dockerhub-user: ${{ secrets.DOCKERHUB_USER }}
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
install-docker-compose: "false"
build: "true"
- name: Use Node.js 20
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 20
- name: Setup supersetbot
uses: ./.github/actions/setup-supersetbot/
- name: Rebuild and push
env:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_PRESET: ${{ matrix.build_preset }}
LATEST_RELEASE: ${{ needs.config.outputs.latest-release }}
FORCE_LATEST_FLAG: ${{ needs.config.outputs.force-latest == '1' && '--force-latest' || '' }}
run: |
# Reuses the same supersetbot invocation as the release
# publisher (`tag-release.yml`), so the resulting tags are
# identical to what a manual release dispatch would produce —
# just with a freshly-pulled base image layer underneath.
# `--force-latest` is only passed when the config job confirmed the
# fetched release is the newest one (see FORCE_LATEST_FLAG above).
supersetbot docker \
--push \
--preset "$BUILD_PRESET" \
--context release \
--context-ref "$LATEST_RELEASE" \
$FORCE_LATEST_FLAG \
--platform "linux/arm64" \
--platform "linux/amd64"
# The whole point of this cron is catching base-image CVEs, so a silent
# failure is the expensive case — a red X in the Actions tab nobody is
# watching on a Monday. File a tracked issue when any rebuild leg fails so
# a missed security refresh surfaces instead of sitting unnoticed.
notify-on-failure:
needs: [config, docker-rebuild]
if: failure() && needs.config.outputs.has-secrets == '1'
runs-on: ubuntu-24.04
permissions:
contents: read
issues: write
steps:
- name: Open a tracking issue
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
LATEST_RELEASE: ${{ needs.config.outputs.latest-release }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
gh issue create \
--repo "$REPOSITORY" \
--title "Scheduled Docker image refresh failed for ${LATEST_RELEASE}" \
--label "infra:container" \
--label "bug" \
--body "The weekly Docker base-image refresh failed for release \`${LATEST_RELEASE}\`. Published images may be missing upstream base-layer security patches until this is resolved.
Failed run: ${RUN_URL}"

View File

@@ -24,14 +24,13 @@ jobs:
permissions: permissions:
contents: read contents: read
issues: write # delete orphaned showtime label definitions (label CRUD is the issues API)
pull-requests: write pull-requests: write
steps: steps:
- name: Install Superset Showtime - name: Install Superset Showtime
run: pip install superset-showtime run: pip install superset-showtime
- name: Cleanup expired environments and orphaned labels - name: Cleanup expired environments
run: | run: |
echo "Cleaning up environments respecting TTL labels, and pruning orphaned 🎪 labels" echo "Cleaning up environments respecting TTL labels"
python -m showtime cleanup --respect-ttl --force python -m showtime cleanup --respect-ttl

View File

@@ -2,8 +2,7 @@ name: 🎪 Superset Showtime
# Ultra-simple: just sync on any PR state change # Ultra-simple: just sync on any PR state change
on: on:
# zizmor: ignore[dangerous-triggers] - required to react to PR label changes; PR code is # zizmor: ignore[dangerous-triggers] - required to react to PR label changes; this workflow does not check out or execute PR-provided code
# only checked out and built after the maintainer-authorization gate (write/admin actors)
pull_request_target: pull_request_target:
types: [labeled, unlabeled, synchronize, closed] types: [labeled, unlabeled, synchronize, closed]
@@ -157,10 +156,6 @@ jobs:
with: with:
ref: ${{ steps.check.outputs.target_sha }} ref: ${{ steps.check.outputs.target_sha }}
persist-credentials: false persist-credentials: false
# Building fork PR code is Showtime's purpose: deploys are gated on the
# maintainer-authorization step above (write/admin actors only), so this
# checkout is an explicit, authorized opt-in rather than an automatic one.
allow-unsafe-pr-checkout: true
- name: Setup Docker Environment (only if build needed) - name: Setup Docker Environment (only if build needed)
if: steps.auth.outputs.authorized == 'true' && steps.check.outputs.build_needed == 'true' if: steps.auth.outputs.authorized == 'true' && steps.check.outputs.build_needed == 'true'

View File

@@ -71,7 +71,7 @@ jobs:
node-version-file: "./docs/.nvmrc" node-version-file: "./docs/.nvmrc"
- name: Setup Python - name: Setup Python
uses: ./.github/actions/setup-backend/ uses: ./.github/actions/setup-backend/
- uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0 - uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
with: with:
distribution: "zulu" distribution: "zulu"
java-version: "21" java-version: "21"

View File

@@ -26,7 +26,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Set up Helm - name: Set up Helm
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1 uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
with: with:
version: v3.16.4 version: v3.16.4

View File

@@ -42,7 +42,7 @@ jobs:
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install Helm - name: Install Helm
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1 uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
with: with:
version: v3.5.4 version: v3.5.4

View File

@@ -28,10 +28,6 @@ jobs:
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: with:
persist-credentials: false persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: './superset-websocket/.nvmrc'
- name: Install dependencies - name: Install dependencies
working-directory: ./superset-websocket working-directory: ./superset-websocket
run: npm ci run: npm ci

View File

@@ -24,12 +24,6 @@ on:
permissions: permissions:
contents: read contents: read
# Serialize with the scheduled Docker image refresh — both workflows push
# to the same Docker Hub tags and must not race on apache/superset:latest.
concurrency:
group: docker-publish-latest-release
cancel-in-progress: false
jobs: jobs:
config: config:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04

0
.pre-commit-config.yaml Executable file → Normal file
View File

View File

@@ -120,7 +120,7 @@ RUN useradd --user-group -d ${SUPERSET_HOME} -m --no-log-init --shell /bin/bash
# Some bash scripts needed throughout the layers # Some bash scripts needed throughout the layers
COPY --chmod=755 docker/*.sh /app/docker/ COPY --chmod=755 docker/*.sh /app/docker/
RUN pip install --no-cache-dir --upgrade uv COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Using uv as it's faster/simpler than pip # Using uv as it's faster/simpler than pip
RUN uv venv /app/.venv RUN uv venv /app/.venv
@@ -141,7 +141,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
COPY superset/translations/ /app/translations_mo/ COPY superset/translations/ /app/translations_mo/
RUN if [ "${BUILD_TRANSLATIONS}" = "true" ]; then \ RUN if [ "${BUILD_TRANSLATIONS}" = "true" ]; then \
pybabel compile --use-fuzzy -d /app/translations_mo || true; \ pybabel compile -d /app/translations_mo | true; \
fi; \ fi; \
rm -f /app/translations_mo/*/*/*.[po,json] rm -f /app/translations_mo/*/*/*.[po,json]

View File

@@ -247,13 +247,16 @@ Understanding the Superset Points of View
- [Superset API](https://superset.apache.org/docs/rest-api) - [Superset API](https://superset.apache.org/docs/rest-api)
<!-- ## Repo Activity
The OSS Insight "Repo Activity" widget (https://next.ossinsight.io/) was
intentionally removed. This README is rendered on the ASF-hosted website <a href="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats?repo_id=39464018" target="_blank" align="center">
(superset.apache.org), so its contents are subject to ASF's third-party <picture>
content and CSP rules. OSS Insight has no Data Processing Agreement (DPA) <source media="(prefers-color-scheme: dark)" srcset="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats/thumbnail.png?repo_id=39464018&image_size=auto&color_scheme=dark" width="655" height="auto" />
with the ASF, so we cannot embed its images/widgets here. Do not re-add it. <img alt="Performance Stats of apache/superset - Last 28 days" src="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats/thumbnail.png?repo_id=39464018&image_size=auto&color_scheme=light" width="655" height="auto" />
--> </picture>
</a>
<!-- Made with [OSS Insight](https://ossinsight.io/) -->
<!-- telemetry/analytics pixel: --> <!-- telemetry/analytics pixel: -->
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=bc1c90cd-bc04-4e11-8c7b-289fb2839492" /> <img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=bc1c90cd-bc04-4e11-8c7b-289fb2839492" />

View File

@@ -24,82 +24,10 @@ assists people when migrating to a new version.
## Next ## Next
- [39925](https://github.com/apache/superset/pull/39925): URL prefixing for `SUPERSET_APP_ROOT` subdirectory deployments is now handled automatically by helpers in `src/utils/navigationUtils` (`openInNewTab`, `redirect`, `getShareableUrl`, `<AppLink>`). Direct imports of `ensureAppRoot` / `makeUrl` from `src/utils/pathUtils` are forbidden outside `navigationUtils.ts` (enforced by a static-invariant test); contributors writing new code should use the focused helpers instead. No runtime behaviour change for existing callers — all 19 prior call sites have been migrated and four pre-existing double-prefix and missing-prefix bugs are fixed as part of the migration.
- [39925](https://github.com/apache/superset/pull/39925): `SupersetClient.getUrl()` now strips a single leading application-root segment from the supplied `endpoint` before building the request URL, so a caller that accidentally pre-prefixes its endpoint (for example by wrapping it with `ensureAppRoot` before passing it to the client) no longer produces a doubled `/superset/superset/...` URL under subdirectory deployment. The strip is **single-pass** — a genuine `/superset/superset/<slug>` route is preserved, not collapsed — and **silent** (no console warning); the static-invariant test remains the primary signal for pre-prefixing at the call site, and this runtime strip is a safety net beneath it. Code that intentionally targeted a literal `/<app_root>/<app_root>/...` endpoint through `getUrl` (a configuration that has no legitimate use under the prefixing model) would have its first redundant segment removed.
- **Breaking — `Superset` view class route prefix removed.** The `Superset` view in `superset/views/core.py` now declares `route_base = ""`, overriding Flask-AppBuilder's auto-derived `/superset` prefix. Routes that previously lived at `/superset/welcome/`, `/superset/dashboard/<id>/`, `/superset/dashboard/p/<key>/`, `/superset/explore/`, etc. now respond at `/welcome/`, `/dashboard/<id>/`, `/dashboard/p/<key>/`, `/explore/`, etc. Under subdirectory deployment (`SUPERSET_APP_ROOT=/superset`) the URLs are unchanged from end-user perspective — `AppRootMiddleware` re-applies the prefix via `SCRIPT_NAME`. Under root deployments, any external integration or bookmark that hard-codes `/superset/<endpoint>/` paths must be updated to drop the prefix. This fixes the doubled `/superset/superset/...` URLs that `url_for` emitted for these endpoints under subdirectory deployment and the related 404s on the routes themselves.
- **Breaking — Three sibling view classes route prefix removed.** Following the same rationale as the `Superset` class above, `ExplorePermalinkView` (`superset/views/explore.py`), `TagModelView`, and `TaggedObjectsModelView` (`superset/views/tags.py`, `superset/views/all_entities.py`) now mount at the application root rather than a hard-coded `/superset/...`. The user-visible URLs `/superset/explore/p/<key>/`, `/superset/tags/`, and `/superset/all_entities/` are unchanged under subdirectory deployment; under root deployments these views now serve `/explore/p/<key>/`, `/tags/`, and `/all_entities/`, so any external integration or bookmark must drop the `/superset/` prefix. `Dashboard.url` and `Dashboard.get_url` likewise return `/dashboard/<id>/` instead of the prior `/superset/dashboard/<id>/` literal so downstream consumers (DashboardList row hrefs, MCP service `dashboard_url`) emit a single, deployment-correct prefix.
- **Legacy `/superset/*` path support.** A new outermost WSGI middleware `LegacyPrefixRedirectMiddleware` (`superset/middleware/legacy_prefix_redirect.py`) 308-redirects every enumerated legacy `/superset/<canonical>` path to its post-`route_base=""` canonical location (e.g. `/superset/welcome/``/welcome/` under root; → `/superset/welcome/` under `SUPERSET_APP_ROOT=/superset`, because the canonical resolves through `AppRootMiddleware`). Bookmarks, email links, and external integrations survive the route-base collapse for one release cycle. POST against a GET-only canonical returns 410 Gone instead of 308 (308 would 405 on retry). The shim is removed at EOL `5.0.0`, matching the `@deprecated(eol_version="5.0.0")` gate on `Superset.explore` and `Superset.explore_json`.
- **PWA web app manifest served dynamically.** The PWA manifest is now served at `/pwa-manifest.json` (under `APPLICATION_ROOT`) by a new `PwaManifestView` (`superset/views/pwa_manifest.py`) instead of the static file at `/static/assets/pwa-manifest.json`. The legacy static source at `superset-frontend/src/pwa-manifest.json` has been removed (along with its `webpack.config.js` `CopyPlugin` rule). The new endpoint resolves `APPLICATION_ROOT` and `STATIC_ASSETS_PREFIX` at request time so PWA install works under subdirectory deployments and split static-prefix / app-root deployments (where `STATIC_ASSETS_PREFIX` points to a CDN host while the Superset backend stays under `APPLICATION_ROOT`). The `<link rel="manifest">` href in `superset/templates/superset/spa.html` was updated correspondingly (using a new `application_root_rstrip` template global). Operators with a forked `spa.html` should switch any manifest `<link>` to `{{ application_root_rstrip }}/pwa-manifest.json`.
- **Hard re-bookmark break — `/superset/sql/<database_id>/`.** SQL Lab moved to its own blueprint at `/sqllab/`. The legacy `/superset/sql/<id>/` shape changed to a query-string form (`/sqllab/?dbid=<id>`); no 1:1 path mapping exists, so `LegacyPrefixRedirectMiddleware` does **not** redirect this route — it passes through and surfaces a 404. Users with bookmarks to `/superset/sql/<id>/` must update them to `/sqllab/?dbid=<id>`.
- **`SqlaTable.sql_url` query-string format.** `SqlaTable.sql_url` now URL-encodes `table_name` and joins it as a query parameter rather than concatenating a second `?`. Previously, with `Database.sql_url` returning `/sqllab/?dbid=<id>`, the concatenation produced `/sqllab/?dbid=<id>?table_name=<raw>` — a malformed second `?` that broke the query parser. External code that parsed the legacy `<base>?table_name=<raw>` shape now sees properly percent-encoded values (e.g. `/``%2F`, ` ``+` or `%20`); decode with `urllib.parse.parse_qsl`.
- **New config flag `EMBEDDED_DISABLE_PERMALINK_ORIGIN_REWRITE` (default `False`).** Share/permalink URLs now substitute `window.location.origin` for the backend-supplied origin so a proxied or subdirectory-deployed Superset never hands the user an unreachable internal hostname. Operators whose reverse proxy correctly forwards `X-Forwarded-Host` *and* who want permalinks to carry the backend's literal origin can opt out by setting `EMBEDDED_DISABLE_PERMALINK_ORIGIN_REWRITE = True` in `superset_config.py`. Default `False` (rewrite is on); flipping the default would regress the dominant proxied/subdir deployment to an unreachable host.
### SQL Lab denies large-object and information_schema access by default
`DISALLOWED_SQL_FUNCTIONS` and `DISALLOWED_SQL_TABLES` now ship with additional default entries, so SQL Lab and chart-data queries that reference them are rejected where they were previously allowed:
- PostgreSQL large-object routines (`lo_from_bytea`, `lo_export`, `lo_import`, `lo_put`, `lo_create`, `lo_creat`, `lowrite`, `lo_get`, `loread`, `lo_unlink`), which read and write bytes on the database server's filesystem.
- The SQL-standard `information_schema` views (`tables`, `columns`, `routines`, `views`, the privilege/grant views, etc.), which expose table, column, privilege, and view-definition metadata across the whole database.
Deployments that legitimately query these (for example tooling that introspects `information_schema`) can restore the previous behavior by overriding `DISALLOWED_SQL_FUNCTIONS` / `DISALLOWED_SQL_TABLES` in `superset_config.py` to drop the entries they need.
Because the denylist now resolves the effective schema through the query-aware path, PostgreSQL queries that change the `search_path` (e.g. `SET search_path = ...`) are rejected on the SQL Lab execution and cost-estimate paths whenever any `DISALLOWED_SQL_TABLES` entry is configured (the default for PostgreSQL), matching the behavior previously applied only when `RLS_IN_SQLLAB` was enabled.
### SQL parser input length cap (SQL_MAX_PARSE_LENGTH)
The SQL parser now rejects scripts whose UTF-8 byte length exceeds the new
`SQL_MAX_PARSE_LENGTH` config option (default `1_000_000` bytes) before they are
handed to sqlglot, which bounds parser memory and CPU usage. A single query
larger than the cap (for example a very large `IN (...)` list or a big
virtual-dataset SQL) raises a parse error in SQL Lab and dashboard-generated
queries. Deployments that legitimately run queries above this size should raise
the value, and `SQL_MAX_PARSE_LENGTH = None` disables the check entirely.
### Guest-token RLS rules reject unknown fields
The `rls` rules passed to `POST /api/v1/security/guest_token/` are now validated strictly: a rule may only contain `dataset` and `clause`. Previously unknown fields were silently dropped, so a mistyped or legacy scope key (most commonly `datasource` instead of `dataset`) produced a rule with no `dataset`, which is treated as a *global* rule applied to every dataset the embedded resource can reach. Such a request now returns HTTP 400 identifying the offending field instead of issuing a token with an unintended global rule. Integrators that were sending extra fields in RLS rules must remove them; valid dataset-scoped (`{"dataset": 41, "clause": "..."}`) and global (`{"clause": "..."}`) rules are unaffected.
### MCP service requires `MCP_JWT_AUDIENCE` when JWT auth is enabled
When the MCP service has JWT auth enabled (`MCP_AUTH_ENABLED = True`), an audience must be configured via `MCP_JWT_AUDIENCE` so issued tokens are bound to this service. The service now fails to start with a clear configuration error when the audience is unset, instead of starting with audience validation skipped. Deployments that enable MCP JWT auth must set `MCP_JWT_AUDIENCE` to the audience value their identity provider issues for the MCP service. API-key-only MCP deployments (JWT auth disabled) are unaffected.
### Swagger UI is opt-in (off by default)
`FAB_API_SWAGGER_UI` now defaults to `False` and is driven by the `SUPERSET_ENABLE_SWAGGER_UI` environment variable. The interactive Swagger UI / OpenAPI documentation endpoints (e.g. `/swagger/v1`) are therefore no longer exposed by default. To enable them, set `SUPERSET_ENABLE_SWAGGER_UI=true` (the bundled Docker development environment sets this) or override `FAB_API_SWAGGER_UI = True` in `superset_config.py`.
### Build details (git SHA / build number) are admin-only by default
The git SHA and build number surfaced in the "About" section, the bootstrap payload, and the public `/version` endpoint are now only included for admin users by default; the release version string is still shown to everyone. To expose the build details to all users (the previous behavior), set the `SUPERSET_EXPOSE_BUILD_DETAILS` environment variable (or `EXPOSE_BUILD_DETAILS_TO_USERS = True` in `superset_config.py`).
### Helm chart adopts Kubernetes recommended labels (breaking upgrade)
The Helm chart now labels and selects workloads using the [Kubernetes recommended labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/) (`app.kubernetes.io/*`) instead of the legacy `app`/`release` labels. Because a Deployment's `spec.selector.matchLabels` is immutable, `helm upgrade` against an existing release will fail with a `field is immutable` error.
To upgrade, delete the affected workloads (which selector labels changed) before upgrading, then run the upgrade so they are recreated with the new labels:
```bash
kubectl delete deployment,statefulset -l release=<release-name> -n <namespace>
helm upgrade <release-name> superset/superset
```
Alternatively, perform a fresh install. This is a one-time migration; subsequent upgrades are unaffected.
### Pivot table First/Last aggregations follow data order ### Pivot table First/Last aggregations follow data order
The pivot table chart's `First` and `Last` aggregations now return the first and last value in data (query result) order, instead of effectively returning the minimum and maximum. Existing pivot tables that use these aggregations for totals/subtotals may show different values after upgrading. For deterministic results, ensure the underlying query has a stable sort order. The pivot table chart's `First` and `Last` aggregations now return the first and last value in data (query result) order, instead of effectively returning the minimum and maximum. Existing pivot tables that use these aggregations for totals/subtotals may show different values after upgrading. For deterministic results, ensure the underlying query has a stable sort order.
### `FetchRetryOptions` callback parameters widened to allow `null`
The `error` and `response` parameters of the `retryDelay` and `retryOn` callbacks in `FetchRetryOptions` (exported from `@superset-ui/core`) are now typed `Error | null` and `Response | null` to match the actual call-site signature provided by `fetch-retry`. Because these parameter types are contravariant, consumers who typed their callbacks with the non-nullable `(attempt: number, error: Error, response: Response) => number` will get a TypeScript compile error. Widen your callback signatures to accept `Error | null` / `Response | null`.
### `thumbnail_url` removed from dashboard list API response ### `thumbnail_url` removed from dashboard list API response
The `thumbnail_url` field has been removed from `GET /api/v1/dashboard/` list responses. External consumers relying on this field must now construct the thumbnail URL client-side using `id` and `changed_on_utc`: The `thumbnail_url` field has been removed from `GET /api/v1/dashboard/` list responses. External consumers relying on this field must now construct the thumbnail URL client-side using `id` and `changed_on_utc`:
@@ -110,20 +38,6 @@ The `thumbnail_url` field has been removed from `GET /api/v1/dashboard/` list re
The thumbnail endpoint redirects to the current digest URL regardless of whether the supplied digest is exact. If the image is not yet cached, that digest URL may return `202` and trigger async generation. Using `changed_on_utc` as the digest is sufficient for cache-busting purposes. The thumbnail endpoint redirects to the current digest URL regardless of whether the supplied digest is exact. If the image is not yet cached, that digest URL may return `202` and trigger async generation. Using `changed_on_utc` as the digest is sufficient for cache-busting purposes.
### Tagging fix for `create_all`-bootstrapped schemas
Only affects deployments whose metadata schema was created with SQLAlchemy's `create_all` (rather than `superset db upgrade`) on a foreign-key-enforcing backend — PostgreSQL, or MySQL with `FOREIGN_KEY_CHECKS=1`. Such schemas carry three invalid foreign keys on `tagged_object.object_id` that break tagging (`TAGGING_SYSTEM = True`) with a `ForeignKeyViolation`. Schemas built via `superset db upgrade` are unaffected.
This release stops the ORM from emitting these constraints, but it cannot drop ones already present in your schema. If affected, drop them manually (names vary by backend, so look them up first):
```sql
-- PostgreSQL: names are typically tagged_object_object_id_fkey, _fkey1, _fkey2
ALTER TABLE tagged_object DROP CONSTRAINT <constraint_name>;
-- MySQL: find names via `SHOW CREATE TABLE tagged_object;`
ALTER TABLE tagged_object DROP FOREIGN KEY <constraint_name>;
```
### Webhook alerts/reports block private/internal hosts by default ### Webhook alerts/reports block private/internal hosts by default
Webhook alert/report dispatch (`WebhookNotification.send`) now validates the target URL's host against the same private/internal-IP block applied to dataset import URLs. If the resolved host is in a loopback, link-local, private (RFC-1918), shared-CGNAT, or multicast range, the webhook is rejected with `NotificationParamException`. Webhook alert/report dispatch (`WebhookNotification.send`) now validates the target URL's host against the same private/internal-IP block applied to dataset import URLs. If the resolved host is in a loopback, link-local, private (RFC-1918), shared-CGNAT, or multicast range, the webhook is rejected with `NotificationParamException`.
@@ -133,7 +47,6 @@ Deployments that intentionally point webhooks at internal targets (chatops bridg
### Impala cancel_query blocks private/internal hosts by default ### Impala cancel_query blocks private/internal hosts by default
The Impala engine spec's `cancel_query` issues an HTTP request from the Superset backend to the host configured on the Impala database connection. That host is now validated before the request: if it resolves to a private/internal IP range, the cancel call is refused and a warning is logged. Operators whose Impala cluster runs on an internal network can opt out by setting `IMPALA_CANCEL_QUERY_ALLOW_INTERNAL_HOSTS = True` in `superset_config.py`. This mirrors the dataset-import and webhook opt-out flags. The Impala engine spec's `cancel_query` issues an HTTP request from the Superset backend to the host configured on the Impala database connection. That host is now validated before the request: if it resolves to a private/internal IP range, the cancel call is refused and a warning is logged. Operators whose Impala cluster runs on an internal network can opt out by setting `IMPALA_CANCEL_QUERY_ALLOW_INTERNAL_HOSTS = True` in `superset_config.py`. This mirrors the dataset-import and webhook opt-out flags.
### Map chart renderer and OpenStreetMap migration behavior ### Map chart renderer and OpenStreetMap migration behavior
The MapLibre migration for deck.gl charts preserves saved non-Mapbox styles on The MapLibre migration for deck.gl charts preserves saved non-Mapbox styles on
@@ -171,11 +84,6 @@ Operators can tune or disable the policy via config:
### Data uploads bounded by UPLOAD_MAX_FILE_SIZE_BYTES ### Data uploads bounded by UPLOAD_MAX_FILE_SIZE_BYTES
Single data-file uploads (CSV, Excel, columnar) are now bounded by the `UPLOAD_MAX_FILE_SIZE_BYTES` config option, which defaults to `100 * 1024 * 1024` (100 MB). Files larger than this are rejected with a `413` before their contents are buffered into memory. Set `UPLOAD_MAX_FILE_SIZE_BYTES = None` to disable the check and restore unbounded uploads. Single data-file uploads (CSV, Excel, columnar) are now bounded by the `UPLOAD_MAX_FILE_SIZE_BYTES` config option, which defaults to `100 * 1024 * 1024` (100 MB). Files larger than this are rejected with a `413` before their contents are buffered into memory. Set `UPLOAD_MAX_FILE_SIZE_BYTES = None` to disable the check and restore unbounded uploads.
### Currency symbol position follows the locale when unset
When a chart's currency control leaves the **Prefix or suffix** field empty, the currency symbol position is now derived from the deployment locale's own convention via `Intl.NumberFormat` instead of always defaulting to a suffix. For example, under the default `en-US` locale `USD`, `GBP`, and `EUR` render as a prefix (`$ 1,000`), while eurozone locales such as `fr-FR` render `EUR` as a suffix (`1 000 €`). An explicit Prefix/Suffix selection is always honored and is unaffected.
Charts that relied on the previous always-suffix default for an unset position will render the symbol on the locale-appropriate side instead; set the position explicitly on the metric's currency control to pin it.
### Duration formatter precision ### Duration formatter precision
@@ -241,18 +149,6 @@ Runbook to adopt:
2. Set that value on the tunnel's `server_host_key` (via the database/SSH tunnel API or UI payload). 2. Set that value on the tunnel's `server_host_key` (via the database/SSH tunnel API or UI payload).
3. Optionally set `SSH_TUNNEL_STRICT_HOST_KEY_CHECKING = True` in `superset_config.py` to require host-key verification on all tunnels. 3. Optionally set `SSH_TUNNEL_STRICT_HOST_KEY_CHECKING = True` in `superset_config.py` to require host-key verification on all tunnels.
### SMTP server certificate validation enabled by default
`SMTP_SSL_SERVER_AUTH` now defaults to `True` (previously `False`). With this default, STARTTLS/SSL connections to the configured SMTP server validate the server's TLS certificate against the system trusted CA store. This makes outbound email (alerts and reports) verify the mail server's identity out of the box.
If your SMTP server presents a self-signed certificate, or a certificate that is not trusted by the system CA store, email delivery may now fail with a certificate verification error. To restore the previous behavior of skipping certificate validation, set the following in `superset_config.py`:
```python
SMTP_SSL_SERVER_AUTH = False
```
The recommended fix is to add the SMTP server's certificate (or its issuing CA) to the system trust store rather than disabling validation.
### Dataset import validates catalog against the target connection ### Dataset import validates catalog against the target connection
Importing a dataset now validates the `catalog` field against the target database connection. When the connection has multi-catalog disabled (`allow_multi_catalog` off) and the dataset's catalog is not the connection's default catalog, the import fails instead of silently persisting the non-default catalog. This matches the validation already enforced on the dataset update path and prevents imported datasets from querying an unintended database. Importing a dataset now validates the `catalog` field against the target database connection. When the connection has multi-catalog disabled (`allow_multi_catalog` off) and the dataset's catalog is not the connection's default catalog, the import fails instead of silently persisting the non-default catalog. This matches the validation already enforced on the dataset update path and prevents imported datasets from querying an unintended database.
@@ -302,28 +198,6 @@ Schedule the cutover in a quiet window. Runtime reads use only the single config
The migration is transactional (all-or-nothing) and idempotent — it can be safely re-run or resumed. Note that AES-GCM, unlike AES-CBC, does not support querying directly over encrypted columns; audit any code that filters on an encrypted column before switching. See the SIP at `docs/sip/authenticated-encryption-at-rest.md` for details. The migration is transactional (all-or-nothing) and idempotent — it can be safely re-run or resumed. Note that AES-GCM, unlike AES-CBC, does not support querying directly over encrypted columns; audit any code that filters on an encrypted column before switching. See the SIP at `docs/sip/authenticated-encryption-at-rest.md` for details.
### Soft delete and restore for dashboards
**Everything in this section applies only when the `SOFT_DELETE` feature flag is enabled. The flag defaults to `False`** (`@lifecycle: development`), so on a default deployment `DELETE /api/v1/dashboard/<id>` continues to **hard-delete permanently** — nothing is recoverable. Enable `SOFT_DELETE` to get the behavior described below.
**Flag-toggle caveat:** the soft-delete visibility filter is evaluated per query while the flag is on. If dashboards are soft-deleted during a flag-on window and the flag is later turned **off**, those rows reappear as live dashboards in all lists and lookups (including slug lookups — if a soft-deleted dashboard's slug was reused while the flag was on, both rows become visible with the same slug). The `POST /<uuid>/restore` endpoint and the `dashboard_deleted_state` list filter remain functional regardless of the flag, deliberately, so rows soft-deleted during a flag-on window stay discoverable and restorable after a rollback of the flag.
With the flag enabled: `DELETE /api/v1/dashboard/<id>` no longer hard-deletes the dashboard (the bulk-delete endpoint behaves the same way). The row is marked with a `deleted_at` timestamp and hidden from the dashboard API's list, detail, and lookup endpoints, which return 404 for soft-deleted dashboards. The embedded-dashboard iframe URL (`/embedded/<uuid>`) keeps rendering because it reads only `embedded.allowed_domains` and `embedded.dashboard_id` (the FK column) without dereferencing the parent dashboard; the frontend's subsequent dashboard-API fetch is what sees the 404 and surfaces "dashboard not found" to the user.
**New endpoint** — `POST /api/v1/dashboard/<uuid>/restore` clears `deleted_at` and returns the dashboard to active state. Requires `can_write on Dashboard` and ownership of the row (or admin). Soft-deleted dashboards can also be surfaced in the list endpoint via the new `dashboard_deleted_state` rison filter: `include` returns both live and soft-deleted rows, `only` returns just the soft-deleted ones. Any other value is ignored. For non-admin users, soft-deleted rows are limited to dashboards they own — the same audience that can restore them.
**Permissions migration:** existing role grants of `can_write on Dashboard` cover the new restore endpoint automatically; no role migration is required.
**Schema migration:** the migration adds a nullable `deleted_at` column and an index on it (`ix_dashboards_deleted_at`) to the `dashboards` table, and **replaces the full unique constraint on `slug`** with a partial unique index (`ix_dashboards_active_slug`) enforcing slug uniqueness only among active (non-soft-deleted) rows. The column add is instant. On Postgres the constraint swap briefly blocks reads and writes during `ALTER TABLE ... DROP CONSTRAINT` (acquires `ACCESS EXCLUSIVE`), then blocks writes only during `CREATE UNIQUE INDEX` (acquires `ShareLock`); reads pass through during the index build. Both windows are sub-second on a typical `dashboards` table. MySQL InnoDB builds the functional index online (no blocking).
**Rollback note:** the downgrade restores the original full unique constraint on `slug`. If the partial-index window allowed slug reuse (a soft-deleted row and an active row holding the same slug), `ALTER TABLE ... ADD CONSTRAINT idx_unique_slug UNIQUE (slug)` will abort with a unique-constraint violation. Before downgrading, hard-delete the soft-deleted duplicates (or rename one side) so each slug appears at most once across all rows. Rolling back the application code while leaving the new migration in place is also possible but exposes soft-deleted rows to the older code path; pair the rollback with a data decision (restore, hard-delete, or migrate-down).
The partial-index replacement is dialect-dependent: PostgreSQL uses a native `WHERE deleted_at IS NULL` partial index; MySQL 8.0.13+ uses a functional index over `(CASE WHEN deleted_at IS NULL THEN slug END)` (8.0.13 is the first release with functional key parts). **MySQL <8.0.13, MariaDB, and SQLite keep the original full unique constraint** (functional indexes / column-level UNIQUE recreation aren't supported cleanly — MariaDB is excluded even at 10.x because its `CASE`-expression index semantics differ), so on those backends a soft-deleted dashboard continues to reserve its slug for the lifetime of the row.
**Slug semantics:** on PostgreSQL and MySQL 8.0.13+, the slug of a soft-deleted dashboard is **free for reuse**. A new active dashboard can claim it immediately. Restoring a soft-deleted dashboard whose slug has since been claimed returns **422 with a clean error** (`DashboardSlugConflictError`) — rename one of the dashboards and retry; the restore is not silently rejected by a database-level constraint violation.
**Importer behavior:** importing a dashboard YAML whose UUID matches an existing **soft-deleted** dashboard is treated as an implicit restore-with-update — **and this happens even when `overwrite` is not set**. This is a deliberate asymmetry with active rows: an active dashboard imported without `overwrite=true` is returned unchanged (the import never mutates it), but a soft-deleted UUID match is restored *and* has the upload's contents applied regardless of the `overwrite` argument, on the reasoning that re-importing a deleted dashboard's exact UUID is an explicit request to bring it back. The restore preserves the original PK and all pre-deletion relationship rows (`dashboard_slices` junctions, role grants, owners, tags) — including role grants that were implicitly revoked by the deletion. Callers whose imports must never mutate existing state should treat bundles that may contain previously deleted UUIDs accordingly. The operation is permission-gated: it requires `can_write` and ownership of the deleted row (or admin) — non-owners get `ImportFailedError`, and callers without `can_write` get `ImportFailedError` instead of silently receiving the soft-deleted row.
### Granular Export Controls ### Granular Export Controls
A new feature flag `GRANULAR_EXPORT_CONTROLS` introduces three fine-grained permissions that replace the legacy `can_csv` permission: A new feature flag `GRANULAR_EXPORT_CONTROLS` introduces three fine-grained permissions that replace the legacy `can_csv` permission:
@@ -613,29 +487,6 @@ See `superset/mcp_service/PRODUCTION.md` for deployment guides.
} }
``` ```
### Composite primary keys on many-to-many association tables
Eight M:N association tables move from a synthetic `id INTEGER PRIMARY KEY` to a composite `PRIMARY KEY (fk1, fk2)` on their two foreign-key columns. The surrogate `id` is dropped, and the redundant `UNIQUE (fk1, fk2)` on the two tables that carried one is removed (now subsumed by the PK).
| Table | Composite PK |
|---|---|
| `dashboard_roles` | `(dashboard_id, role_id)` |
| `dashboard_slices` | `(dashboard_id, slice_id)` |
| `dashboard_user` | `(user_id, dashboard_id)` |
| `report_schedule_user` | `(user_id, report_schedule_id)` |
| `rls_filter_roles` | `(role_id, rls_filter_id)` |
| `rls_filter_tables` | `(table_id, rls_filter_id)` |
| `slice_user` | `(user_id, slice_id)` |
| `sqlatable_user` | `(user_id, table_id)` |
**Before upgrading:**
- The migration **deletes** two classes of pre-existing rows the composite PK cannot accommodate: duplicate `(fk1, fk2)` pairs (it keeps the lowest `id` and removes the rest) and rows with `NULL` in either FK column. Both are meaningless for `secondary=` association tables, but export the affected rows first if you need an audit record.
- External tooling (BI tools, backup scripts) that references the surrogate `id` on these tables will break; no application code references it.
- Downgrade restores the `id` column (and the original `UNIQUE` on the two tables that had it) but leaves the FK columns `NOT NULL` (intentional — a `NULL` FK in a junction row is meaningless).
For large `dashboard_slices` / `report_schedule_user` tables, see the operator runbook in [#39859](https://github.com/apache/superset/pull/39859) — pre-flight inventory queries, per-dialect lock-window sizing, and the duplicate / NULL-FK roll-up — to plan the maintenance window.
## 6.0.0 ## 6.0.0
- [33055](https://github.com/apache/superset/pull/33055): Upgrades Flask-AppBuilder to 5.0.0. The AUTH_OID authentication type has been deprecated and is no longer available as an option in Flask-AppBuilder. OpenID (OID) is considered a deprecated authentication protocol - if you are using AUTH_OID, you will need to migrate to an alternative authentication method such as OAuth, LDAP, or database authentication before upgrading. - [33055](https://github.com/apache/superset/pull/33055): Upgrades Flask-AppBuilder to 5.0.0. The AUTH_OID authentication type has been deprecated and is no longer available as an option in Flask-AppBuilder. OpenID (OID) is considered a deprecated authentication protocol - if you are using AUTH_OID, you will need to migrate to an alternative authentication method such as OAuth, LDAP, or database authentication before upgrading.
- [34871](https://github.com/apache/superset/pull/34871): Fixed Jest test hanging issue from Ant Design v5 upgrade. MessageChannel is now mocked in test environment to prevent rc-overflow from causing Jest to hang. Test environment only - no production impact. - [34871](https://github.com/apache/superset/pull/34871): Fixed Jest test hanging issue from Ant Design v5 upgrade. MessageChannel is now mocked in test environment to prevent rc-overflow from causing Jest to hang. Test environment only - no production impact.

View File

@@ -70,8 +70,6 @@ SUPERSET_LOG_LEVEL=info
SUPERSET_APP_ROOT="/" SUPERSET_APP_ROOT="/"
SUPERSET_ENV=development SUPERSET_ENV=development
# Swagger UI is opt-in (off by default); enable it for local development.
SUPERSET_ENABLE_SWAGGER_UI=true
SUPERSET_LOAD_EXAMPLES=yes SUPERSET_LOAD_EXAMPLES=yes
CYPRESS_CONFIG=false CYPRESS_CONFIG=false
SUPERSET_PORT=8088 SUPERSET_PORT=8088

View File

@@ -1 +0,0 @@
../superset-frontend/.nvmrc

1
docs/.nvmrc Normal file
View File

@@ -0,0 +1 @@
v24.16.0

View File

@@ -81,21 +81,6 @@ SLACK_CACHE_TIMEOUT = int(timedelta(days=2).total_seconds())
SLACK_API_RATE_LIMIT_RETRY_COUNT = 5 SLACK_API_RATE_LIMIT_RETRY_COUNT = 5
``` ```
#### Slack Enterprise Grid (org-scoped tokens)
On a Slack Enterprise Grid org, an org-scoped token spans multiple workspaces, so
workspace-scoped methods such as `conversations.list` require a `team_id` to
indicate which workspace to target. Set `SLACK_TEAM_ID` to your workspace (team)
ID so Superset can list channels and deliver reports:
```python
# The workspace (team) ID to target, e.g. "T01234567"
SLACK_TEAM_ID = "T01234567"
```
This defaults to `None` and only needs to be set when using an org-scoped token;
it is accepted but ignored for standard workspace-level tokens.
### Webhook integration ### Webhook integration
Superset can send alert and report notifications to any HTTP endpoint — useful for chat platforms, incident management tools, or custom automation. Superset can send alert and report notifications to any HTTP endpoint — useful for chat platforms, incident management tools, or custom automation.
@@ -175,7 +160,7 @@ When enabled, Superset rejects webhook configurations that use `http://` URLs.
#### Retry Behavior #### Retry Behavior
Superset automatically retries webhook deliveries on `429 Too Many Requests` and `5xx` server errors using exponential backoff. Retries are bounded to roughly 120 seconds of cumulative wall-clock time (worst case ~210 seconds, because the bound is checked against the time elapsed before each attempt, so the final request can begin just under the limit and still run its full request timeout), after which the delivery is abandoned. Superset automatically retries webhook deliveries on `429 Too Many Requests` and `5xx` server errors using exponential backoff.
### Kubernetes-specific ### Kubernetes-specific

View File

@@ -549,24 +549,6 @@ CELERY_BEAT_SCHEDULE = {
Adjust `retention_period_days` to control how long query rows are kept. Companion opt-in tasks (`prune_logs`, `prune_tasks`) exist for pruning the logs and tasks tables; see the commented-out examples in `superset/config.py`. Without enabling these tasks, the metadata database will grow unbounded over time. Adjust `retention_period_days` to control how long query rows are kept. Companion opt-in tasks (`prune_logs`, `prune_tasks`) exist for pruning the logs and tasks tables; see the commented-out examples in `superset/config.py`. Without enabling these tasks, the metadata database will grow unbounded over time.
## Dashboard Layout Size Limit
Each dashboard stores its layout (the position, size, and nesting of every chart, row, and tab) as a JSON blob in the metadata database. Superset caps the length of this serialized blob with `SUPERSET_DASHBOARD_POSITION_DATA_LIMIT`, which defaults to `65535`:
```python
SUPERSET_DASHBOARD_POSITION_DATA_LIMIT = 65535
```
This is a Python-level cap (65535 is 2¹⁶ 1), independent of the database column capacity — the `position_json` column is a `MEDIUMTEXT`, which holds far more. When the serialized layout reaches this limit, the editor blocks the save and reports the current length, the limit, and this setting's name. A warning is shown once the layout passes 90% of the limit.
Large dashboards — for example, many charts spread across nested tabs — can exceed the default. Because the underlying column comfortably stores larger values, you can safely raise the limit:
```python
SUPERSET_DASHBOARD_POSITION_DATA_LIMIT = 131072 # double the default
```
Alternatively, split a very large dashboard into several smaller ones. Note that this check is enforced when saving layout edits in the UI; a dashboard imported from a ZIP with an oversized layout will load and render, but cannot be edited and re-saved until the limit is raised.
:::resources :::resources
- [Blog: Feature Flags in Apache Superset](https://preset.io/blog/feature-flags-in-apache-superset-and-preset/) - [Blog: Feature Flags in Apache Superset](https://preset.io/blog/feature-flags-in-apache-superset-and-preset/)
::: :::

View File

@@ -223,9 +223,8 @@ compose based installation, edit the `x-superset-image:` line in your `docker-co
`docker-compose-non-dev.yml` files, replacing `apachesuperset.docker.scarf.sh/apache/superset` with `docker-compose-non-dev.yml` files, replacing `apachesuperset.docker.scarf.sh/apache/superset` with
`apache/superset` to pull the image directly from Docker Hub. `apache/superset` to pull the image directly from Docker Hub.
To disable the Scarf telemetry pixel, set the `SCARF_ANALYTICS` environment variable to `false` in To disable the Scarf telemetry pixel, set the `SCARF_ANALYTICS` environment variable to `False` in
your `docker/.env` file. This is read at runtime, so it disables the pixel on the pre-built image your terminal and/or in your `docker/.env` file.
without rebuilding the frontend.
::: :::
## 3. Log in to Superset ## 3. Log in to Superset

View File

@@ -136,17 +136,7 @@ init:
:::note :::note
Superset uses [Scarf Gateway](https://about.scarf.sh/scarf-gateway) to collect telemetry data. Knowing the installation counts for different Superset versions informs the project's decisions about patching and long-term support. Scarf purges personally identifiable information (PII) and provides only aggregated statistics. Superset uses [Scarf Gateway](https://about.scarf.sh/scarf-gateway) to collect telemetry data. Knowing the installation counts for different Superset versions informs the project's decisions about patching and long-term support. Scarf purges personally identifiable information (PII) and provides only aggregated statistics.
There are two independent telemetry channels: To opt-out of this data collection in your Helm-based installation, edit the `repository:` line in your `helm/superset/values.yaml` file, replacing `apachesuperset.docker.scarf.sh/apache/superset` with `apache/superset` to pull the image directly from Docker Hub.
- **Image pulls** (Scarf Gateway): to opt out, edit the `repository:` line in your `helm/superset/values.yaml` file, replacing `apachesuperset.docker.scarf.sh/apache/superset` with `apache/superset` to pull the image directly from Docker Hub.
- **The analytics pixel** rendered in the UI: to opt out, set the `SCARF_ANALYTICS` environment variable to `false` on the Superset containers via `extraEnv` in your `values.yaml`:
```yaml
extraEnv:
SCARF_ANALYTICS: "false"
```
This is read at runtime, so it takes effect on the pre-built images without rebuilding the frontend.
::: :::
### Dependencies ### Dependencies

View File

@@ -161,7 +161,6 @@ Here's the documentation section how how to set up Talisman: https://superset.ap
- [ ] Regularly update to the latest major or minor versions of Superset. Those versions receive up-to-date security patches. - [ ] Regularly update to the latest major or minor versions of Superset. Those versions receive up-to-date security patches.
- [ ] Rotate the `SUPERSET_SECRET_KEY` periodically (e.g., quarterly) and after any potential security incident. - [ ] Rotate the `SUPERSET_SECRET_KEY` periodically (e.g., quarterly) and after any potential security incident.
- [ ] Rotate the other security-critical secrets (guest-token and async-query JWT secrets, SMTP and database credentials) on the cadence in Appendix C, and after any potential security incident.
- [ ] Conduct quarterly access reviews for all users. - [ ] Conduct quarterly access reviews for all users.
- [ ] Assuming logging and monitoring is in place, review security monitoring alerts weekly. - [ ] Assuming logging and monitoring is in place, review security monitoring alerts weekly.
@@ -174,24 +173,6 @@ Rotating the `SUPERSET_SECRET_KEY` is a critical security procedure. It is manda
The procedure for safely rotating the SECRET_KEY must be followed precisely to avoid locking yourself out of your instance. The official Apache Superset documentation maintains the correct, up-to-date procedure. Please follow the official guide here: The procedure for safely rotating the SECRET_KEY must be followed precisely to avoid locking yourself out of your instance. The official Apache Superset documentation maintains the correct, up-to-date procedure. Please follow the official guide here:
https://superset.apache.org/admin-docs/configuration/configuring-superset/#rotating-to-a-newer-secret_key https://superset.apache.org/admin-docs/configuration/configuring-superset/#rotating-to-a-newer-secret_key
### **Appendix C: Secrets Register and Rotation Schedule**
`SUPERSET_SECRET_KEY` is not the only security-critical secret in a Superset deployment. Maintain an inventory of all such secrets, store each in a secrets manager (not in `superset_config.py` or version control), assign an owner, and rotate them on a defined cadence as well as after any suspected compromise.
| Secret | Purpose | Risk if leaked | Suggested rotation |
|---|---|---|---|
| `SUPERSET_SECRET_KEY` | Signs session cookies; key material for encrypting stored DB credentials (Fernet/AES) | Forged sessions (auth bypass / privilege escalation); decryption of exfiltrated metadata-DB secrets | Quarterly + post-incident |
| `GUEST_TOKEN_JWT_SECRET` | Signs embedded-dashboard guest tokens | Forged guest tokens → unauthorized dashboard/data access | Quarterly + post-incident |
| `GLOBAL_ASYNC_QUERIES_JWT_SECRET` | Signs the async-query channel JWT | Forged async-query tokens | Quarterly + post-incident |
| SMTP password | Outbound email for alerts & reports | Email relay abuse / spoofing | Per organizational policy + post-incident |
| Database connection passwords | Access to analytical databases and the metadata DB | Direct database access | Per organizational policy + post-incident |
Notes:
- Rotating `GUEST_TOKEN_JWT_SECRET` or `GLOBAL_ASYNC_QUERIES_JWT_SECRET` invalidates outstanding tokens of that type; schedule rotations accordingly.
- After a suspected compromise, rotate **all** of the above, not only `SUPERSET_SECRET_KEY`.
- Keep the register under change control so new secrets introduced by future features are added to the rotation schedule.
:::resources :::resources
- [Blog: Running Apache Superset on the Open Internet](https://preset.io/blog/running-apache-superset-on-the-open-internet-a-report-from-the-fireline/) - [Blog: Running Apache Superset on the Open Internet](https://preset.io/blog/running-apache-superset-on-the-open-internet-a-report-from-the-fireline/)
- [Blog: How Security Vulnerabilities are Reported & Handled in Apache Superset](https://preset.io/blog/how-security-vulnerabilities-are-reported-and-handled-in-apache-superset/) - [Blog: How Security Vulnerabilities are Reported & Handled in Apache Superset](https://preset.io/blog/how-security-vulnerabilities-are-reported-and-handled-in-apache-superset/)

View File

@@ -332,28 +332,15 @@ cd superset-frontend
npm run build-translation npm run build-translation
# Backend # Backend
pybabel compile --use-fuzzy -d superset/translations pybabel compile -d superset/translations
``` ```
`--use-fuzzy` includes `#, fuzzy` entries in the compiled `.mo` files. Superset
serves fuzzy translations on purpose: the frontend build (`po2json --fuzzy`)
already includes them, `flask fab babel-compile` (used by the release images)
compiles with `-f`, and the production `Dockerfile` compiles with `--use-fuzzy`
as well. This keeps machine-generated (and other draft) translations visible in
the UI rather than falling back to English while they await review.
### Backfilling missing translations with AI ### Backfilling missing translations with AI
For languages with many untranslated strings, the repo includes a script that For languages with many untranslated strings, the repo includes a script that
uses Claude AI to generate draft translations for any missing entries. All uses Claude AI to generate draft translations for any missing entries. All
AI-generated strings are marked `#, fuzzy` and tagged with an attribution AI-generated strings are marked `#, fuzzy` and tagged with an attribution
comment so that human reviewers know they need to be checked. comment so that human reviewers know they need to be checked before merging.
Note that `#, fuzzy` marks a translation as *needing review*, not as *withheld*:
both the frontend and backend builds serve fuzzy entries (see [Applying
translations](#applying-translations) above), so an AI-generated string is shown
in the UI as soon as it is built and deployed. Reviewers should verify each
entry and remove the `#, fuzzy` flag to promote it to a confirmed translation.
#### Prerequisites #### Prerequisites

View File

@@ -34,14 +34,15 @@ Frontend contribution types allow extensions to extend Superset's user interface
Extensions can add new views or panels to the host application, such as custom SQL Lab panels, dashboards, or other UI components. Contribution areas are uniquely identified (e.g., `sqllab.panels` for SQL Lab panels), enabling seamless integration into specific parts of the application. Extensions can add new views or panels to the host application, such as custom SQL Lab panels, dashboards, or other UI components. Contribution areas are uniquely identified (e.g., `sqllab.panels` for SQL Lab panels), enabling seamless integration into specific parts of the application.
```typescript ```tsx
import React from 'react';
import { views } from '@apache-superset/core'; import { views } from '@apache-superset/core';
import MyPanel from './MyPanel'; import MyPanel from './MyPanel';
views.registerView( views.registerView(
{ id: 'my-extension.main', name: 'My Panel Name' }, { id: 'my-extension.main', name: 'My Panel Name' },
'sqllab.panels', 'sqllab.panels',
MyPanel, () => <MyPanel />,
); );
``` ```
@@ -111,24 +112,6 @@ editors.registerEditor(
See [Editors Extension Point](./extension-points/editors.md) for implementation details. See [Editors Extension Point](./extension-points/editors.md) for implementation details.
### Chat
Extensions can add a chat interface to Superset by registering a trigger component and a panel component. The host owns the layout, open/close state, and display mode — the extension only provides the UI. The panel can be displayed as a floating overlay or docked as a resizable sidebar beside the page content, and the user's preference is persisted across reloads.
```tsx
import { chat } from '@apache-superset/core';
import ChatTrigger from './ChatTrigger';
import ChatPanel from './ChatPanel';
chat.registerChat(
{ id: 'my-org.my-chat', name: 'My Chat' },
ChatTrigger,
ChatPanel,
);
```
See [Chat](./extension-points/chat.md) for implementation details.
## Backend ## Backend
Backend contribution types allow extensions to extend Superset's server-side capabilities. Backend contributions are registered at startup via classes and functions imported from the auto-discovered `entrypoint.py` file. Backend contribution types allow extensions to extend Superset's server-side capabilities. Backend contributions are registered at startup via classes and functions imported from the auto-discovered `entrypoint.py` file.

View File

@@ -1,141 +0,0 @@
---
title: Chat
sidebar_position: 3
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# Chat Contributions
Extensions can add a chat interface to Superset by registering a trigger and a panel. The host owns the layout, open/close state, and display mode — the extension only needs to provide the UI components.
## Overview
A chat registration consists of two React components:
| Component | Role |
|-----------|------|
| **Trigger** | Always-visible entry point (e.g., a floating button). Rendered in the bottom-right corner in floating mode, or as a fixed overlay in panel mode. |
| **Panel** | The chat UI itself (message list, input, etc.). Mounted by the host in the active display mode. |
## Display Modes
The host supports two display modes, switchable by the user or the extension at runtime:
| Mode | Behavior |
|------|----------|
| `floating` | Panel floats above page content, anchored to the bottom-right corner. |
| `panel` | Panel is docked to the right side of the application as a resizable sidebar, sitting beside the page content. |
The user's last selected mode and open/closed state are persisted across page reloads.
## Registering a Chat
Call `chat.registerChat` from your extension's entry point with a descriptor, a trigger factory, and a panel factory:
```tsx
import { chat } from '@apache-superset/core';
import ChatTrigger from './ChatTrigger';
import ChatPanel from './ChatPanel';
chat.registerChat(
{ id: 'my-org.my-chat', name: 'My Chat' },
ChatTrigger,
ChatPanel,
);
```
Only one chat registration is active at a time. If a second extension calls `registerChat`, it replaces the first and a warning is logged.
## Opening and Closing the Chat
The trigger component is responsible for toggling the panel. Use `chat.isOpen()`, `chat.open()`, and `chat.close()` to control visibility:
```tsx
import { chat } from '@apache-superset/core';
export default function ChatTrigger() {
return (
<button onClick={() => (chat.isOpen() ? chat.close() : chat.open())}>
💬
</button>
);
}
```
You can also subscribe to open/close events from any component:
```tsx
useEffect(() => {
const { dispose } = chat.onDidOpen(() => console.log('chat opened'));
return dispose;
}, []);
```
## Changing the Display Mode
Call `chat.setDisplayMode` to switch between `'floating'` and `'panel'` modes. In your panel component, subscribe to `onDidChangeDisplayMode` to react to changes (including those triggered by the user):
```tsx
import { useState, useEffect } from 'react';
import { chat } from '@apache-superset/core';
export default function ChatPanel() {
const [mode, setMode] = useState(chat.getDisplayMode());
useEffect(() => {
const { dispose } = chat.onDidChangeDisplayMode(m => setMode(m));
return dispose;
}, []);
return (
<div style={{ height: mode === 'panel' ? '100%' : '80vh' }}>
<button onClick={() => chat.setDisplayMode(mode === 'panel' ? 'floating' : 'panel')}>
{mode === 'panel' ? 'Float' : 'Dock'}
</button>
{/* message list and input */}
</div>
);
}
```
## Chat API Reference
All methods are available on the `chat` namespace from `@apache-superset/core`:
| Method / Event | Description |
|----------------|-------------|
| `registerChat(descriptor, trigger, panel)` | Register a chat extension. Returns a `Disposable` to unregister. |
| `open()` | Open the chat panel. No-op if already open or no registration. |
| `close()` | Close the chat panel. |
| `isOpen()` | Returns `true` if the panel is currently open. |
| `getDisplayMode()` | Returns the current display mode (`'floating'` or `'panel'`). |
| `setDisplayMode(mode)` | Switch between `'floating'` and `'panel'` mode. |
| `onDidOpen(listener)` | Subscribe to panel open events. Returns a `Disposable`. |
| `onDidClose(listener)` | Subscribe to panel close events. Returns a `Disposable`. |
| `onDidChangeDisplayMode(listener)` | Subscribe to display mode changes. Returns a `Disposable`. |
| `onDidRegisterChat(listener)` | Subscribe to registration events. |
| `onDidUnregisterChat(listener)` | Subscribe to unregistration events. |
| `onDidResizePanel(listener)` | Subscribe to panel resize events (panel mode only). Not all hosts provide a resizer — do not rely on this firing. Returns a `Disposable`. |
## Next Steps
- **[Contribution Types](../contribution-types.md)** — Explore other contribution types
- **[Development](../development.md)** — Set up your development environment

View File

@@ -47,8 +47,6 @@ module.exports = {
collapsed: true, collapsed: true,
items: [ items: [
'extensions/extension-points/sqllab', 'extensions/extension-points/sqllab',
'extensions/extension-points/editors',
'extensions/extension-points/chat',
], ],
}, },
'extensions/development', 'extensions/development',

View File

@@ -321,8 +321,8 @@ This can be used, for example, to convert UTC time to local time.
Superset uses [Scarf](https://about.scarf.sh/) by default to collect basic telemetry data upon installing and/or running Superset. This data helps the maintainers of Superset better understand which versions of Superset are being used, in order to prioritize patch/minor releases and security fixes. Superset uses [Scarf](https://about.scarf.sh/) by default to collect basic telemetry data upon installing and/or running Superset. This data helps the maintainers of Superset better understand which versions of Superset are being used, in order to prioritize patch/minor releases and security fixes.
We use the [Scarf Gateway](https://docs.scarf.sh/gateway/) to sit in front of container registries, the [scarf-js](https://about.scarf.sh/package-sdks) package to track `npm` installations, and a Scarf pixel to gather anonymous analytics on Superset page views. We use the [Scarf Gateway](https://docs.scarf.sh/gateway/) to sit in front of container registries, the [scarf-js](https://about.scarf.sh/package-sdks) package to track `npm` installations, and a Scarf pixel to gather anonymous analytics on Superset page views.
Scarf purges PII and provides aggregated statistics. Superset users can easily opt out of analytics in various ways documented [here](https://docs.scarf.sh/gateway/#do-not-track) and [here](https://docs.scarf.sh/package-analytics/#as-a-user-of-a-package-using-scarf-js-how-can-i-opt-out-of-analytics). Scarf purges PII and provides aggregated statistics. Superset users can easily opt out of analytics in various ways documented [here](https://docs.scarf.sh/gateway/#do-not-track) and [here](https://docs.scarf.sh/package-analytics/#as-a-user-of-a-package-using-scarf-js-how-can-i-opt-out-of-analytics).
You can also opt out of the analytics pixel by setting the `SCARF_ANALYTICS` environment variable to `false`. This is read at runtime, so setting it on the Superset container (for example via `extraEnv` in the Helm chart, or `docker/.env` for Docker Compose) disables the pixel on the pre-built images without rebuilding the frontend. Note that this only disables the page-view pixel; the Scarf Gateway (container registry) and `scarf-js` (`npm`) channels are opted out separately, as described above. Superset maintainers can also opt out of telemetry data collection by setting the `SCARF_ANALYTICS` environment variable to `false` in the Superset container (or anywhere Superset/webpack are run).
Additional opt-out instructions are available on the [Docker Compose](/admin-docs/installation/docker-compose) and [Kubernetes](/admin-docs/installation/kubernetes) installation pages. Additional opt-out instructions for Docker users are available on the [Docker Installation](/admin-docs/installation/docker-compose) page.
## Does Superset have an archive panel or trash bin from which a user can recover deleted assets? ## Does Superset have an archive panel or trash bin from which a user can recover deleted assets?

View File

@@ -254,13 +254,16 @@ Understanding the Superset Points of View
- [Superset API](/developer-docs/api) - [Superset API](/developer-docs/api)
<!-- ## Repo Activity
The OSS Insight "Repo Activity" widget (https://next.ossinsight.io/) was
intentionally removed. This page is rendered on the ASF-hosted website <a href="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats?repo_id=39464018" target="_blank" align="center">
(superset.apache.org), so its contents are subject to ASF's third-party <picture>
content and CSP rules. OSS Insight has no Data Processing Agreement (DPA) <source media="(prefers-color-scheme: dark)" srcset="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats/thumbnail.png?repo_id=39464018&image_size=auto&color_scheme=dark" width="655" height="auto" />
with the ASF, so we cannot embed its images/widgets here. Do not re-add it. <img alt="Performance Stats of apache/superset - Last 28 days" src="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats/thumbnail.png?repo_id=39464018&image_size=auto&color_scheme=light" width="655" height="auto" />
--> </picture>
</a>
<!-- Made with [OSS Insight](https://ossinsight.io/) -->
<!-- telemetry/analytics pixel: --> <!-- telemetry/analytics pixel: -->
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=bc1c90cd-bc04-4e11-8c7b-289fb2839492" /> <img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=bc1c90cd-bc04-4e11-8c7b-289fb2839492" />

View File

@@ -749,7 +749,7 @@ const config: Config = {
showReadingTime: true, showReadingTime: true,
// Please change this to your repo. // Please change this to your repo.
editUrl: editUrl:
'https://github.com/apache/superset/tree/master/docs', 'https://github.com/facebook/docusaurus/edit/main/website/blog/',
}, },
theme: { theme: {
customCss: require.resolve('./src/styles/custom.css'), customCss: require.resolve('./src/styles/custom.css'),

View File

@@ -58,15 +58,25 @@
"@fontsource/inter": "^5.2.8", "@fontsource/inter": "^5.2.8",
"@mdx-js/react": "^3.1.1", "@mdx-js/react": "^3.1.1",
"@saucelabs/theme-github-codeblock": "^0.3.0", "@saucelabs/theme-github-codeblock": "^0.3.0",
"@storybook/addon-docs": "^10.4.5", "@storybook/addon-docs": "^8.6.18",
"@storybook/blocks": "^8.6.15",
"@storybook/channels": "^8.6.18",
"@storybook/client-logger": "^8.6.18",
"@storybook/components": "^8.6.18",
"@storybook/core": "^8.6.18",
"@storybook/core-events": "^8.6.18",
"@storybook/csf": "^0.1.13",
"@storybook/docs-tools": "^8.6.18",
"@storybook/preview-api": "^8.6.18",
"@storybook/theming": "^8.6.15",
"@superset-ui/core": "^0.20.4", "@superset-ui/core": "^0.20.4",
"@swc/core": "^1.15.43", "@swc/core": "^1.15.41",
"antd": "^6.4.5", "antd": "^6.4.4",
"baseline-browser-mapping": "^2.10.38", "baseline-browser-mapping": "^2.10.37",
"caniuse-lite": "^1.0.30001799", "caniuse-lite": "^1.0.30001799",
"docusaurus-plugin-openapi-docs": "^5.1.0", "docusaurus-plugin-openapi-docs": "^5.0.2",
"docusaurus-theme-openapi-docs": "^5.1.0", "docusaurus-theme-openapi-docs": "^5.0.2",
"js-yaml": "^5.1.0", "js-yaml": "^4.2.0",
"js-yaml-loader": "^1.2.2", "js-yaml-loader": "^1.2.2",
"json-bigint": "^1.0.0", "json-bigint": "^1.0.0",
"prism-react-renderer": "^2.4.1", "prism-react-renderer": "^2.4.1",
@@ -78,8 +88,8 @@
"react-table": "^7.8.0", "react-table": "^7.8.0",
"remark-import-partial": "^0.0.2", "remark-import-partial": "^0.0.2",
"reselect": "^5.2.0", "reselect": "^5.2.0",
"storybook": "^10.4.5", "storybook": "^8.6.18",
"swagger-ui-react": "^5.32.8", "swagger-ui-react": "^5.32.6",
"swc-loader": "^0.2.7", "swc-loader": "^0.2.7",
"tinycolor2": "^1.4.2", "tinycolor2": "^1.4.2",
"unist-util-visit": "^5.1.0" "unist-util-visit": "^5.1.0"
@@ -96,10 +106,10 @@
"eslint-config-prettier": "^10.1.8", "eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.6", "eslint-plugin-prettier": "^5.5.6",
"eslint-plugin-react": "^7.37.5", "eslint-plugin-react": "^7.37.5",
"globals": "^17.7.0", "globals": "^17.6.0",
"prettier": "^3.8.4", "prettier": "^3.8.4",
"typescript": "~6.0.3", "typescript": "~6.0.3",
"typescript-eslint": "^8.62.0", "typescript-eslint": "^8.61.1",
"webpack": "^5.107.2" "webpack": "^5.107.2"
}, },
"browserslist": { "browserslist": {
@@ -124,8 +134,7 @@
"yaml": "1.10.3", "yaml": "1.10.3",
"uuid": "11.1.1", "uuid": "11.1.1",
"serialize-javascript": "7.0.5", "serialize-javascript": "7.0.5",
"d3-color": "3.1.0", "d3-color": "3.1.0"
"ws": "^8.21.0"
}, },
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610" "packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
} }

View File

@@ -168,6 +168,60 @@ export default function webpackExtendPlugin(): Plugin<void> {
__dirname, __dirname,
'../../superset-frontend/packages/superset-core/src', '../../superset-frontend/packages/superset-core/src',
), ),
// Add proper Storybook aliases
'@storybook/blocks': path.resolve(
__dirname,
'../node_modules/@storybook/blocks',
),
'@storybook/components': path.resolve(
__dirname,
'../node_modules/@storybook/components',
),
'@storybook/theming': path.resolve(
__dirname,
'../node_modules/@storybook/theming',
),
'@storybook/client-logger': path.resolve(
__dirname,
'../node_modules/@storybook/client-logger',
),
'@storybook/core-events': path.resolve(
__dirname,
'../node_modules/@storybook/core-events',
),
// Add internal Storybook aliases
'storybook/internal/components': path.resolve(
__dirname,
'../node_modules/@storybook/components',
),
'storybook/internal/theming': path.resolve(
__dirname,
'../node_modules/@storybook/theming',
),
'storybook/internal/client-logger': path.resolve(
__dirname,
'../node_modules/@storybook/client-logger',
),
'storybook/internal/csf': path.resolve(
__dirname,
'../node_modules/@storybook/csf',
),
'storybook/internal/preview-api': path.resolve(
__dirname,
'../node_modules/@storybook/preview-api',
),
'storybook/internal/docs-tools': path.resolve(
__dirname,
'../node_modules/@storybook/docs-tools',
),
'storybook/internal/core-events': path.resolve(
__dirname,
'../node_modules/@storybook/core-events',
),
'storybook/internal/channels': path.resolve(
__dirname,
'../node_modules/@storybook/channels',
),
}, },
}, },
}; };

View File

@@ -22,14 +22,7 @@ RewriteRule ^(.*)$ https://superset.apache.org/$1 [R,L]
RewriteCond %{HTTP_HOST} ^superset.incubator.apache.org$ [NC] RewriteCond %{HTTP_HOST} ^superset.incubator.apache.org$ [NC]
RewriteRule ^(.*)$ https://superset.apache.org/$1 [R=301,L] RewriteRule ^(.*)$ https://superset.apache.org/$1 [R=301,L]
# CSP permissions for superset.apache.org Header set Content-Security-Policy "default-src data: blob: 'self' *.apache.org widget.kapa.ai *.githubusercontent.com *.scarf.sh *.googleapis.com *.google.com *.run.app *.gstatic.com *.github.com *.algolia.net *.algolianet.com 'unsafe-inline' 'unsafe-eval'; frame-src *; frame-ancestors 'self' *.google.com https://sidebar.bugherd.com; form-action 'self'; worker-src blob:; img-src 'self' blob: data: https:; font-src 'self'; object-src 'none'"
# Additional domains required for docs site functionality:
# - widget.kapa.ai: AI chatbot widget (uses Google reCAPTCHA). Approval here: https://privacy.apache.org/faq/committers.html
# - *.googleapis.com, *.google.com, *.gstatic.com: Google Calendar embed, kapa.ai reCAPTCHA - all of these loaded with user consent, following policy laid out in https://privacy.apache.org/faq/committers.html
# - github.com, *.github.com, *.githubusercontent.com: GitHub user-attachment images in docs (apex github.com serves user-attachments/* assets). Discussed/resolved in this thread: https://issues.apache.org/jira/browse/INFRA-25701?filter=-2 (DPA in place with GitHub)
# - *.algolia.net, *.algolianet.com: Algolia DocSearch. Approved here: https://privacy.apache.org/faq/committers.html
# See: https://infra.apache.org/tools/csp.html
SetEnv CSP_PROJECT_DOMAINS "widget.kapa.ai https://*.googleapis.com/ https://*.google.com/ https://*.gstatic.com/ https://github.com/ https://*.github.com/ https://*.githubusercontent.com/ https://*.algolia.net/ https://*.algolianet.com/"
# REDIRECTS # REDIRECTS

View File

@@ -87,12 +87,6 @@
"lifecycle": "development", "lifecycle": "development",
"description": "Enable semantic layers and show semantic views alongside datasets" "description": "Enable semantic layers and show semantic views alongside datasets"
}, },
{
"name": "SOFT_DELETE",
"default": false,
"lifecycle": "development",
"description": "Temporary rollout / kill-switch gate for soft delete (default off = legacy hard delete). An emergency stop, not a clean rollback: flipping ON->OFF resurrects already-soft-deleted rows. Removed (along with its two gate points \u2014 BaseDAO.delete routing and the do_orm_execute visibility listener) once soft delete is stable."
},
{ {
"name": "TABLE_V2_TIME_COMPARISON_ENABLED", "name": "TABLE_V2_TIME_COMPARISON_ENABLED",
"default": false, "default": false,

View File

@@ -519,80 +519,6 @@ For a connection to a SQL endpoint you need to use the HTTP path from the endpoi
{"connect_args": {"http_path": "/sql/1.0/endpoints/****", "driver_path": "/path/to/odbc/driver"}} {"connect_args": {"http_path": "/sql/1.0/endpoints/****", "driver_path": "/path/to/odbc/driver"}}
``` ```
##### OAuth2 Authentication
Superset supports OAuth2 authentication for Databricks, allowing users to authenticate with their personal Databricks accounts instead of using shared access tokens. This provides better security and audit capabilities.
###### Prerequisites
1. Create an OAuth2 application in your Databricks account:
- Go to your Databricks account console
- Navigate to **Settings** → **Developer** → **OAuth apps**
- Create a new OAuth app with the redirect URI: `http://your-superset-host:port/api/v1/database/oauth2/`
2. Configure OAuth2 in your `superset_config.py`:
```python
from datetime import timedelta
# OAuth2 configuration for Databricks
# The authorization endpoint is derived from your Databricks workspace host; the
# token endpoint must be set explicitly (see notes below).
DATABASE_OAUTH2_CLIENTS = {
"Databricks (legacy)": {
"id": "your-databricks-client-id",
"secret": "your-databricks-client-secret",
"scope": "sql",
"token_request_uri": "https://your-workspace-host/oidc/v1/token",
},
"Databricks": {
"id": "your-databricks-client-id",
"secret": "your-databricks-client-secret",
"scope": "sql",
"token_request_uri": "https://your-workspace-host/oidc/v1/token",
},
}
# OAuth2 redirect URI (adjust hostname/port for your setup)
DATABASE_OAUTH2_REDIRECT_URI = "http://your-superset-host:port/api/v1/database/oauth2/"
# Optional: OAuth2 timeout
DATABASE_OAUTH2_TIMEOUT = timedelta(seconds=30)
```
Replace the following placeholders:
- `your-databricks-client-id`: Your Databricks OAuth2 application client ID
- `your-databricks-client-secret`: Your Databricks OAuth2 application client secret
- `your-superset-host:port`: Your Superset instance hostname and port
**Multi-Cloud Provider Support**
Databricks fronts the user-to-machine (U2M) OAuth2 flow on every workspace at
`https://<workspace-host>/oidc/v1/authorize` and
`https://<workspace-host>/oidc/v1/token`, regardless of whether the workspace
runs on AWS, Azure, or GCP. Superset derives the **authorization** endpoint
directly from your connection's host, so no cloud provider or account/tenant
identifier needs to be configured.
The **token** endpoint cannot be auto-derived (token exchange has no database
context to read the host), so you must supply `token_request_uri` in
`DATABASE_OAUTH2_CLIENTS`, set to `https://<workspace-host>/oidc/v1/token` for
your workspace.
If you supply a fully-resolved `authorization_request_uri` (and/or
`token_request_uri`), those values take precedence over the host-derived
defaults.
###### Usage
Once configured, users can:
1. Connect to Databricks databases normally using access tokens
2. When querying data, Superset will automatically redirect users to authenticate with Databricks if needed
3. User-specific OAuth2 tokens will be used for database connections, providing better security and audit trails
This feature works with both "Databricks (legacy)" and "Databricks" engine types and automatically supports all major cloud providers (AWS, Azure, GCP).
#### Denodo #### Denodo
The recommended connector library for Denodo is The recommended connector library for Denodo is

View File

@@ -212,13 +212,16 @@ Understanding the Superset Points of View
- [Superset API](https://superset.apache.org/docs/rest-api) - [Superset API](https://superset.apache.org/docs/rest-api)
<!-- ## Repo Activity
The OSS Insight "Repo Activity" widget (https://next.ossinsight.io/) was
intentionally removed. This page is rendered on the ASF-hosted website <a href="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats?repo_id=39464018" target="_blank" align="center">
(superset.apache.org), so its contents are subject to ASF's third-party <picture>
content and CSP rules. OSS Insight has no Data Processing Agreement (DPA) <source media="(prefers-color-scheme: dark)" srcset="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats/thumbnail.png?repo_id=39464018&image_size=auto&color_scheme=dark" width="655" height="auto" />
with the ASF, so we cannot embed its images/widgets here. Do not re-add it. <img alt="Performance Stats of apache/superset - Last 28 days" src="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats/thumbnail.png?repo_id=39464018&image_size=auto&color_scheme=light" width="655" height="auto" />
--> </picture>
</a>
<!-- Made with [OSS Insight](https://ossinsight.io/) -->
<!-- telemetry/analytics pixel: --> <!-- telemetry/analytics pixel: -->
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=bc1c90cd-bc04-4e11-8c7b-289fb2839492" /> <img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=bc1c90cd-bc04-4e11-8c7b-289fb2839492" />

View File

@@ -254,13 +254,16 @@ Understanding the Superset Points of View
- [Superset API](/developer-docs/api) - [Superset API](/developer-docs/api)
<!-- ## Repo Activity
The OSS Insight "Repo Activity" widget (https://next.ossinsight.io/) was
intentionally removed. This page is rendered on the ASF-hosted website <a href="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats?repo_id=39464018" target="_blank" align="center">
(superset.apache.org), so its contents are subject to ASF's third-party <picture>
content and CSP rules. OSS Insight has no Data Processing Agreement (DPA) <source media="(prefers-color-scheme: dark)" srcset="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats/thumbnail.png?repo_id=39464018&image_size=auto&color_scheme=dark" width="655" height="auto" />
with the ASF, so we cannot embed its images/widgets here. Do not re-add it. <img alt="Performance Stats of apache/superset - Last 28 days" src="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats/thumbnail.png?repo_id=39464018&image_size=auto&color_scheme=light" width="655" height="auto" />
--> </picture>
</a>
<!-- Made with [OSS Insight](https://ossinsight.io/) -->
<!-- telemetry/analytics pixel: --> <!-- telemetry/analytics pixel: -->
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=bc1c90cd-bc04-4e11-8c7b-289fb2839492" /> <img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=bc1c90cd-bc04-4e11-8c7b-289fb2839492" />

View File

@@ -246,13 +246,16 @@ Understanding the Superset Points of View
- [Superset API](https://superset.apache.org/docs/rest-api) - [Superset API](https://superset.apache.org/docs/rest-api)
<!-- ## Repo Activity
The OSS Insight "Repo Activity" widget (https://next.ossinsight.io/) was
intentionally removed. This page is rendered on the ASF-hosted website <a href="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats?repo_id=39464018" target="_blank" align="center">
(superset.apache.org), so its contents are subject to ASF's third-party <picture>
content and CSP rules. OSS Insight has no Data Processing Agreement (DPA) <source media="(prefers-color-scheme: dark)" srcset="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats/thumbnail.png?repo_id=39464018&image_size=auto&color_scheme=dark" width="655" height="auto" />
with the ASF, so we cannot embed its images/widgets here. Do not re-add it. <img alt="Performance Stats of apache/superset - Last 28 days" src="https://next.ossinsight.io/widgets/official/compose-last-28-days-stats/thumbnail.png?repo_id=39464018&image_size=auto&color_scheme=light" width="655" height="auto" />
--> </picture>
</a>
<!-- Made with [OSS Insight](https://ossinsight.io/) -->
<!-- telemetry/analytics pixel: --> <!-- telemetry/analytics pixel: -->
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=bc1c90cd-bc04-4e11-8c7b-289fb2839492" /> <img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=bc1c90cd-bc04-4e11-8c7b-289fb2839492" />

File diff suppressed because it is too large Load Diff

View File

@@ -29,7 +29,7 @@ maintainers:
- name: craig-rueda - name: craig-rueda
email: craig@craigrueda.com email: craig@craigrueda.com
url: https://github.com/craig-rueda url: https://github.com/craig-rueda
version: 0.19.0 # See [README](https://github.com/apache/superset/blob/master/helm/superset/README.md#versioning) for version details. version: 0.17.2 # See [README](https://github.com/apache/superset/blob/master/helm/superset/README.md#versioning) for version details.
dependencies: dependencies:
- name: postgresql - name: postgresql
version: 16.7.27 version: 16.7.27

View File

@@ -23,7 +23,7 @@ NOTE: This file is generated by helm-docs: https://github.com/norwoodj/helm-docs
# superset # superset
![Version: 0.19.0](https://img.shields.io/badge/Version-0.19.0-informational?style=flat-square) ![Version: 0.17.2](https://img.shields.io/badge/Version-0.17.2-informational?style=flat-square)
Apache Superset is a modern, enterprise-ready business intelligence web application Apache Superset is a modern, enterprise-ready business intelligence web application
@@ -46,21 +46,6 @@ It should be a long random bytes or str.
On helm this can be set on `extraSecretEnv.SUPERSET_SECRET_KEY` or `configOverrides.secrets` On helm this can be set on `extraSecretEnv.SUPERSET_SECRET_KEY` or `configOverrides.secrets`
## Upgrade Notes
### Kubernetes recommended labels (breaking)
This chart labels and selects workloads using the [Kubernetes recommended labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/) (`app.kubernetes.io/*`) instead of the legacy `app`/`release` labels. A Deployment's `spec.selector.matchLabels` is immutable, so `helm upgrade` against a release created before this change fails with a `field is immutable` error.
To upgrade an existing release, delete the affected workloads first (their selector labels changed), then upgrade so they are recreated:
```console
kubectl delete deployment,statefulset -l release=<release-name> -n <namespace>
helm upgrade <release-name> superset/superset
```
Alternatively, perform a fresh install. This is a one-time migration; subsequent upgrades are unaffected.
## Requirements ## Requirements
| Repository | Name | Version | | Repository | Name | Version |
@@ -103,7 +88,6 @@ Alternatively, perform a fresh install. This is a one-time migration; subsequent
| ingress.path | string | `"/"` | | | ingress.path | string | `"/"` | |
| ingress.pathType | string | `"ImplementationSpecific"` | | | ingress.pathType | string | `"ImplementationSpecific"` | |
| ingress.tls | list | `[]` | | | ingress.tls | list | `[]` | |
| init.additionalPodSpec | object | `{}` | Custom pod spec to be added to init job |
| init.adminUser.email | string | `"admin@superset.com"` | | | init.adminUser.email | string | `"admin@superset.com"` | |
| init.adminUser.firstname | string | `"Superset"` | | | init.adminUser.firstname | string | `"Superset"` | |
| init.adminUser.lastname | string | `"Admin"` | | | init.adminUser.lastname | string | `"Admin"` | |
@@ -147,7 +131,6 @@ Alternatively, perform a fresh install. This is a one-time migration; subsequent
| supersetCeleryBeat.affinity | object | `{}` | Affinity to be added to supersetCeleryBeat deployment | | supersetCeleryBeat.affinity | object | `{}` | Affinity to be added to supersetCeleryBeat deployment |
| supersetCeleryBeat.command | list | a `celery beat` command | Command | | supersetCeleryBeat.command | list | a `celery beat` command | Command |
| supersetCeleryBeat.containerSecurityContext | object | `{}` | | | supersetCeleryBeat.containerSecurityContext | object | `{}` | |
| supersetCeleryBeat.deploymentAdditionalPodSpec | object | `{}` | Custom pod spec to be added to supersetCeleryBeat deployment |
| supersetCeleryBeat.deploymentAnnotations | object | `{}` | Annotations to be added to supersetCeleryBeat deployment | | supersetCeleryBeat.deploymentAnnotations | object | `{}` | Annotations to be added to supersetCeleryBeat deployment |
| supersetCeleryBeat.enabled | bool | `false` | This is only required if you intend to use alerts and reports | | supersetCeleryBeat.enabled | bool | `false` | This is only required if you intend to use alerts and reports |
| supersetCeleryBeat.extraContainers | list | `[]` | Launch additional containers into supersetCeleryBeat pods | | supersetCeleryBeat.extraContainers | list | `[]` | Launch additional containers into supersetCeleryBeat pods |
@@ -166,7 +149,6 @@ Alternatively, perform a fresh install. This is a one-time migration; subsequent
| supersetCeleryFlower.affinity | object | `{}` | Affinity to be added to supersetCeleryFlower deployment | | supersetCeleryFlower.affinity | object | `{}` | Affinity to be added to supersetCeleryFlower deployment |
| supersetCeleryFlower.command | list | a `celery flower` command | Command | | supersetCeleryFlower.command | list | a `celery flower` command | Command |
| supersetCeleryFlower.containerSecurityContext | object | `{}` | | | supersetCeleryFlower.containerSecurityContext | object | `{}` | |
| supersetCeleryFlower.deploymentAdditionalPodSpec | object | `{}` | Custom pod spec to be added to supersetCeleryFlower deployment |
| supersetCeleryFlower.deploymentAnnotations | object | `{}` | Annotations to be added to supersetCeleryFlower deployment | | supersetCeleryFlower.deploymentAnnotations | object | `{}` | Annotations to be added to supersetCeleryFlower deployment |
| supersetCeleryFlower.enabled | bool | `false` | Enables a Celery flower deployment (management UI to monitor celery jobs) WARNING: on superset 1.x, this requires a Superset image that has `flower<1.0.0` installed (which is NOT the case of the default images) flower>=1.0.0 requires Celery 5+ which Superset 1.5 does not support | | supersetCeleryFlower.enabled | bool | `false` | Enables a Celery flower deployment (management UI to monitor celery jobs) WARNING: on superset 1.x, this requires a Superset image that has `flower<1.0.0` installed (which is NOT the case of the default images) flower>=1.0.0 requires Celery 5+ which Superset 1.5 does not support |
| supersetCeleryFlower.extraContainers | list | `[]` | Launch additional containers into supersetCeleryFlower pods | | supersetCeleryFlower.extraContainers | list | `[]` | Launch additional containers into supersetCeleryFlower pods |
@@ -222,14 +204,12 @@ Alternatively, perform a fresh install. This is a one-time migration; subsequent
| supersetNode.connections.db_user | string | `"superset"` | | | supersetNode.connections.db_user | string | `"superset"` | |
| supersetNode.connections.redis_cache_db | string | `"1"` | | | supersetNode.connections.redis_cache_db | string | `"1"` | |
| supersetNode.connections.redis_celery_db | string | `"0"` | | | supersetNode.connections.redis_celery_db | string | `"0"` | |
| supersetNode.connections.redis_driver | string | `""` | |
| supersetNode.connections.redis_host | string | `"{{ .Release.Name }}-redis-headless"` | Change in case of bringing your own redis and then also set redis.enabled:false | | supersetNode.connections.redis_host | string | `"{{ .Release.Name }}-redis-headless"` | Change in case of bringing your own redis and then also set redis.enabled:false |
| supersetNode.connections.redis_port | string | `"6379"` | | | supersetNode.connections.redis_port | string | `"6379"` | |
| supersetNode.connections.redis_ssl.enabled | bool | `false` | | | supersetNode.connections.redis_ssl.enabled | bool | `false` | |
| supersetNode.connections.redis_ssl.ssl_cert_reqs | string | `"CERT_NONE"` | | | supersetNode.connections.redis_ssl.ssl_cert_reqs | string | `"CERT_NONE"` | |
| supersetNode.connections.redis_user | string | `""` | | | supersetNode.connections.redis_user | string | `""` | |
| supersetNode.containerSecurityContext | object | `{}` | | | supersetNode.containerSecurityContext | object | `{}` | |
| supersetNode.deploymentAdditionalPodSpec | object | `{}` | Custom pod spec to be added to supersetNode deployment |
| supersetNode.deploymentAnnotations | object | `{}` | Annotations to be added to supersetNode deployment | | supersetNode.deploymentAnnotations | object | `{}` | Annotations to be added to supersetNode deployment |
| supersetNode.deploymentLabels | object | `{}` | Labels to be added to supersetNode deployment | | supersetNode.deploymentLabels | object | `{}` | Labels to be added to supersetNode deployment |
| supersetNode.env | object | `{}` | | | supersetNode.env | object | `{}` | |
@@ -275,7 +255,6 @@ Alternatively, perform a fresh install. This is a one-time migration; subsequent
| supersetWebsockets.command | list | `[]` | | | supersetWebsockets.command | list | `[]` | |
| supersetWebsockets.config | object | see `values.yaml` | The config.json to pass to the server, see https://github.com/apache/superset/tree/master/superset-websocket Note that the configuration can also read from environment variables (which will have priority), see https://github.com/apache/superset/blob/master/superset-websocket/src/config.ts for a list of supported variables | | supersetWebsockets.config | object | see `values.yaml` | The config.json to pass to the server, see https://github.com/apache/superset/tree/master/superset-websocket Note that the configuration can also read from environment variables (which will have priority), see https://github.com/apache/superset/blob/master/superset-websocket/src/config.ts for a list of supported variables |
| supersetWebsockets.containerSecurityContext | object | `{}` | | | supersetWebsockets.containerSecurityContext | object | `{}` | |
| supersetWebsockets.deploymentAdditionalPodSpec | object | `{}` | Custom pod spec to be added to supersetWebsockets deployment |
| supersetWebsockets.deploymentAnnotations | object | `{}` | | | supersetWebsockets.deploymentAnnotations | object | `{}` | |
| supersetWebsockets.enabled | bool | `false` | This is only required if you intend to use `GLOBAL_ASYNC_QUERIES` in `ws` mode see https://superset.apache.org/docs/contributing/misc#async-chart-queries | | supersetWebsockets.enabled | bool | `false` | This is only required if you intend to use `GLOBAL_ASYNC_QUERIES` in `ws` mode see https://superset.apache.org/docs/contributing/misc#async-chart-queries |
| supersetWebsockets.extraContainers | list | `[]` | Launch additional containers into supersetWebsockets pods | | supersetWebsockets.extraContainers | list | `[]` | Launch additional containers into supersetWebsockets pods |
@@ -329,7 +308,6 @@ Alternatively, perform a fresh install. This is a one-time migration; subsequent
| supersetWorker.autoscaling.targetCPUUtilizationPercentage | int | `80` | | | supersetWorker.autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| supersetWorker.command | list | a `celery worker` command | Worker startup command | | supersetWorker.command | list | a `celery worker` command | Worker startup command |
| supersetWorker.containerSecurityContext | object | `{}` | | | supersetWorker.containerSecurityContext | object | `{}` | |
| supersetWorker.deploymentAdditionalPodSpec | object | `{}` | Custom pod spec to be added to supersetWorker deployment |
| supersetWorker.deploymentAnnotations | object | `{}` | Annotations to be added to supersetWorker deployment | | supersetWorker.deploymentAnnotations | object | `{}` | Annotations to be added to supersetWorker deployment |
| supersetWorker.deploymentLabels | object | `{}` | Labels to be added to supersetWorker deployment | | supersetWorker.deploymentLabels | object | `{}` | Labels to be added to supersetWorker deployment |
| supersetWorker.extraContainers | list | `[]` | Launch additional containers into supersetWorker pod | | supersetWorker.extraContainers | list | `[]` | Launch additional containers into supersetWorker pod |

View File

@@ -45,21 +45,6 @@ It should be a long random bytes or str.
On helm this can be set on `extraSecretEnv.SUPERSET_SECRET_KEY` or `configOverrides.secrets` On helm this can be set on `extraSecretEnv.SUPERSET_SECRET_KEY` or `configOverrides.secrets`
## Upgrade Notes
### Kubernetes recommended labels (breaking)
This chart labels and selects workloads using the [Kubernetes recommended labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/) (`app.kubernetes.io/*`) instead of the legacy `app`/`release` labels. A Deployment's `spec.selector.matchLabels` is immutable, so `helm upgrade` against a release created before this change fails with a `field is immutable` error.
To upgrade an existing release, delete the affected workloads first (their selector labels changed), then upgrade so they are recreated:
```console
kubectl delete deployment,statefulset -l release=<release-name> -n <namespace>
helm upgrade <release-name> superset/superset
```
Alternatively, perform a fresh install. This is a one-time migration; subsequent upgrades are unaffected.
{{ template "chart.requirementsSection" . }} {{ template "chart.requirementsSection" . }}
{{ template "chart.valuesSection" . }} {{ template "chart.valuesSection" . }}

View File

@@ -61,49 +61,6 @@ Create chart name and version as used by the chart label.
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{/*
Common labels for all resources - follows Kubernetes recommended labels
https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/
*/}}
{{- define "superset.labels" -}}
helm.sh/chart: {{ include "superset.chart" . }}
{{ include "superset.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/part-of: superset
{{- if .Values.extraLabels }}
{{ toYaml .Values.extraLabels }}
{{- end }}
{{- end -}}
{{/*
Selector labels - used by selectors and matchLabels
*/}}
{{- define "superset.selectorLabels" -}}
app.kubernetes.io/name: {{ include "superset.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Component labels - extends superset.labels with component-specific labels
Usage: {{ include "superset.componentLabels" (dict "component" "web" "root" .) }}
*/}}
{{- define "superset.componentLabels" -}}
{{ include "superset.labels" .root }}
app.kubernetes.io/component: {{ .component }}
{{- end -}}
{{/*
Component selector labels - for matchLabels with component
Usage: {{ include "superset.componentSelectorLabels" (dict "component" "web" "root" .) }}
*/}}
{{- define "superset.componentSelectorLabels" -}}
{{ include "superset.selectorLabels" .root }}
app.kubernetes.io/component: {{ .component }}
{{- end -}}
{{- define "superset-config" }} {{- define "superset-config" }}
import os import os
@@ -114,9 +71,9 @@ def env(key, default=None):
# Redis Base URL # Redis Base URL
{{- if .Values.supersetNode.connections.redis_password }} {{- if .Values.supersetNode.connections.redis_password }}
REDIS_BASE_URL=f"{env('REDIS_DRIVER') or env('REDIS_PROTO')}://{env('REDIS_USER', '')}:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}" REDIS_BASE_URL=f"{env('REDIS_PROTO')}://{env('REDIS_USER', '')}:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}"
{{- else }} {{- else }}
REDIS_BASE_URL=f"{env('REDIS_DRIVER') or env('REDIS_PROTO')}://{env('REDIS_HOST')}:{env('REDIS_PORT')}" REDIS_BASE_URL=f"{env('REDIS_PROTO')}://{env('REDIS_HOST')}:{env('REDIS_PORT')}"
{{- end }} {{- end }}
# Redis URL Params # Redis URL Params
@@ -151,6 +108,8 @@ else:
{{ fail (printf "Unsupported database type: %s. Please use 'postgresql' or 'mysql'." .Values.supersetNode.connections.db_type) }} {{ fail (printf "Unsupported database type: %s. Please use 'postgresql' or 'mysql'." .Values.supersetNode.connections.db_type) }}
{{- end }} {{- end }}
SQLALCHEMY_TRACK_MODIFICATIONS = True
class CeleryConfig: class CeleryConfig:
imports = ("superset.sql_lab", ) imports = ("superset.sql_lab", )
broker_url = CELERY_REDIS_URL broker_url = CELERY_REDIS_URL
@@ -189,32 +148,27 @@ RESULTS_BACKEND = RedisCache(
{{- end }} {{- end }}
{{- define "supersetNode.selectorLabels" -}}
app.kubernetes.io/name: {{ include "superset.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: web
{{- end }}
{{- define "supersetCeleryBeat.selectorLabels" -}} {{- define "supersetCeleryBeat.selectorLabels" -}}
app.kubernetes.io/name: {{ include "superset.name" . }} app: {{ include "superset.name" . }}-celerybeat
app.kubernetes.io/instance: {{ .Release.Name }} release: {{ .Release.Name }}
app.kubernetes.io/component: celerybeat
{{- end }} {{- end }}
{{- define "supersetCeleryFlower.selectorLabels" -}} {{- define "supersetCeleryFlower.selectorLabels" -}}
app.kubernetes.io/name: {{ include "superset.name" . }} app: {{ include "superset.name" . }}-flower
app.kubernetes.io/instance: {{ .Release.Name }} release: {{ .Release.Name }}
app.kubernetes.io/component: flower {{- end }}
{{- define "supersetNode.selectorLabels" -}}
app: {{ include "superset.name" . }}
release: {{ .Release.Name }}
{{- end }} {{- end }}
{{- define "supersetWebsockets.selectorLabels" -}} {{- define "supersetWebsockets.selectorLabels" -}}
app.kubernetes.io/name: {{ include "superset.name" . }} app: {{ include "superset.name" . }}-ws
app.kubernetes.io/instance: {{ .Release.Name }} release: {{ .Release.Name }}
app.kubernetes.io/component: websocket
{{- end }} {{- end }}
{{- define "supersetWorker.selectorLabels" -}} {{- define "supersetWorker.selectorLabels" -}}
app.kubernetes.io/name: {{ include "superset.name" . }} app: {{ include "superset.name" . }}-worker
app.kubernetes.io/instance: {{ .Release.Name }} release: {{ .Release.Name }}
app.kubernetes.io/component: worker
{{- end }} {{- end }}

View File

@@ -24,7 +24,13 @@ metadata:
name: {{ template "superset.fullname" . }}-extra-config name: {{ template "superset.fullname" . }}-extra-config
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.labels" . | nindent 4 }} app: {{ template "superset.name" . }}
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
data: data:
{{- range $path, $config := .Values.extraConfigs }} {{- range $path, $config := .Values.extraConfigs }}
{{ $path }}: | {{ $path }}: |

View File

@@ -24,7 +24,13 @@ metadata:
name: {{ template "superset.fullname" . }}-celerybeat name: {{ template "superset.fullname" . }}-celerybeat
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.componentLabels" (dict "component" "celerybeat" "root" .) | nindent 4 }} app: {{ template "superset.name" . }}-celerybeat
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
{{- if .Values.supersetCeleryBeat.deploymentAnnotations }} {{- if .Values.supersetCeleryBeat.deploymentAnnotations }}
annotations: {{- toYaml .Values.supersetCeleryBeat.deploymentAnnotations | nindent 4 }} annotations: {{- toYaml .Values.supersetCeleryBeat.deploymentAnnotations | nindent 4 }}
{{- end }} {{- end }}
@@ -53,14 +59,15 @@ spec:
{{- toYaml .Values.supersetCeleryBeat.podAnnotations | nindent 8 }} {{- toYaml .Values.supersetCeleryBeat.podAnnotations | nindent 8 }}
{{- end }} {{- end }}
labels: labels:
{{- include "supersetCeleryBeat.selectorLabels" . | nindent 8 }} app: "{{ template "superset.name" . }}-celerybeat"
release: {{ .Release.Name }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 8 }}
{{- end }}
{{- if .Values.supersetCeleryBeat.podLabels }} {{- if .Values.supersetCeleryBeat.podLabels }}
{{- toYaml .Values.supersetCeleryBeat.podLabels | nindent 8 }} {{- toYaml .Values.supersetCeleryBeat.podLabels | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
{{- if .Values.supersetCeleryBeat.deploymentAdditionalPodSpec }}
{{- tpl (toYaml .Values.supersetCeleryBeat.deploymentAdditionalPodSpec) . | nindent 6 }}
{{- end }}
{{- if or (.Values.serviceAccount.create) (.Values.serviceAccountName) }} {{- if or (.Values.serviceAccount.create) (.Values.serviceAccountName) }}
serviceAccountName: {{ template "superset.serviceAccountName" . }} serviceAccountName: {{ template "superset.serviceAccountName" . }}
{{- end }} {{- end }}

View File

@@ -24,7 +24,13 @@ metadata:
name: {{ template "superset.fullname" . }}-flower name: {{ template "superset.fullname" . }}-flower
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.componentLabels" (dict "component" "flower" "root" .) | nindent 4 }} app: {{ template "superset.name" . }}-flower
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
{{- if .Values.supersetCeleryFlower.deploymentAnnotations }} {{- if .Values.supersetCeleryFlower.deploymentAnnotations }}
annotations: {{- toYaml .Values.supersetCeleryFlower.deploymentAnnotations | nindent 4 }} annotations: {{- toYaml .Values.supersetCeleryFlower.deploymentAnnotations | nindent 4 }}
{{- end }} {{- end }}
@@ -42,14 +48,15 @@ spec:
{{- toYaml .Values.supersetCeleryFlower.podAnnotations | nindent 8 }} {{- toYaml .Values.supersetCeleryFlower.podAnnotations | nindent 8 }}
{{- end }} {{- end }}
labels: labels:
{{- include "supersetCeleryFlower.selectorLabels" . | nindent 8 }} app: "{{ template "superset.name" . }}-flower"
release: {{ .Release.Name }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 8 }}
{{- end }}
{{- if .Values.supersetCeleryFlower.podLabels }} {{- if .Values.supersetCeleryFlower.podLabels }}
{{- toYaml .Values.supersetCeleryFlower.podLabels | nindent 8 }} {{- toYaml .Values.supersetCeleryFlower.podLabels | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
{{- if .Values.supersetCeleryFlower.deploymentAdditionalPodSpec }}
{{- tpl (toYaml .Values.supersetCeleryFlower.deploymentAdditionalPodSpec) . | nindent 6 }}
{{- end }}
{{- if or (.Values.serviceAccount.create) (.Values.serviceAccountName) }} {{- if or (.Values.serviceAccount.create) (.Values.serviceAccountName) }}
serviceAccountName: {{ template "superset.serviceAccountName" . }} serviceAccountName: {{ template "superset.serviceAccountName" . }}
{{- end }} {{- end }}

View File

@@ -23,9 +23,15 @@ metadata:
name: {{ template "superset.fullname" . }}-worker name: {{ template "superset.fullname" . }}-worker
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.componentLabels" (dict "component" "worker" "root" .) | nindent 4 }} app: {{ template "superset.name" . }}-worker
{{- with .Values.supersetWorker.deploymentLabels }} chart: {{ template "superset.chart" . }}
{{- toYaml . | nindent 4 }} release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
{{- if .Values.supersetWorker.deploymentLabels }}
{{- toYaml .Values.supersetWorker.deploymentLabels | nindent 4 }}
{{- end }} {{- end }}
{{- if .Values.supersetWorker.deploymentAnnotations }} {{- if .Values.supersetWorker.deploymentAnnotations }}
annotations: {{- toYaml .Values.supersetWorker.deploymentAnnotations | nindent 4 }} annotations: {{- toYaml .Values.supersetWorker.deploymentAnnotations | nindent 4 }}
@@ -59,14 +65,15 @@ spec:
{{- toYaml .Values.supersetWorker.podAnnotations | nindent 8 }} {{- toYaml .Values.supersetWorker.podAnnotations | nindent 8 }}
{{- end }} {{- end }}
labels: labels:
{{- include "supersetWorker.selectorLabels" . | nindent 8 }} app: {{ template "superset.name" . }}-worker
release: {{ .Release.Name }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 8 }}
{{- end }}
{{- if .Values.supersetWorker.podLabels }} {{- if .Values.supersetWorker.podLabels }}
{{- toYaml .Values.supersetWorker.podLabels | nindent 8 }} {{- toYaml .Values.supersetWorker.podLabels | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
{{- if .Values.supersetWorker.deploymentAdditionalPodSpec }}
{{- tpl (toYaml .Values.supersetWorker.deploymentAdditionalPodSpec) . | nindent 6 }}
{{- end }}
{{- if or (.Values.serviceAccount.create) (.Values.serviceAccountName) }} {{- if or (.Values.serviceAccount.create) (.Values.serviceAccountName) }}
serviceAccountName: {{ template "superset.serviceAccountName" . }} serviceAccountName: {{ template "superset.serviceAccountName" . }}
{{- end }} {{- end }}

View File

@@ -24,7 +24,13 @@ metadata:
name: "{{ template "superset.fullname" . }}-ws" name: "{{ template "superset.fullname" . }}-ws"
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.componentLabels" (dict "component" "websocket" "root" .) | nindent 4 }} app: "{{ template "superset.name" . }}-ws"
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
{{- if .Values.supersetWebsockets.deploymentAnnotations }} {{- if .Values.supersetWebsockets.deploymentAnnotations }}
annotations: {{- toYaml .Values.supersetWebsockets.deploymentAnnotations | nindent 4 }} annotations: {{- toYaml .Values.supersetWebsockets.deploymentAnnotations | nindent 4 }}
{{- end }} {{- end }}
@@ -45,14 +51,15 @@ spec:
{{- toYaml .Values.supersetWebsockets.podAnnotations | nindent 8 }} {{- toYaml .Values.supersetWebsockets.podAnnotations | nindent 8 }}
{{- end }} {{- end }}
labels: labels:
{{- include "supersetWebsockets.selectorLabels" . | nindent 8 }} app: "{{ template "superset.name" . }}-ws"
release: {{ .Release.Name }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 8 }}
{{- end }}
{{- if .Values.supersetWebsockets.podLabels }} {{- if .Values.supersetWebsockets.podLabels }}
{{- toYaml .Values.supersetWebsockets.podLabels | nindent 8 }} {{- toYaml .Values.supersetWebsockets.podLabels | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
{{- if .Values.supersetWebsockets.deploymentAdditionalPodSpec }}
{{- tpl (toYaml .Values.supersetWebsockets.deploymentAdditionalPodSpec) . | nindent 6 }}
{{- end }}
{{- if or (.Values.serviceAccount.create) (.Values.serviceAccountName) }} {{- if or (.Values.serviceAccount.create) (.Values.serviceAccountName) }}
serviceAccountName: {{ template "superset.serviceAccountName" . }} serviceAccountName: {{ template "superset.serviceAccountName" . }}
{{- end }} {{- end }}

View File

@@ -23,9 +23,15 @@ metadata:
name: {{ template "superset.fullname" . }} name: {{ template "superset.fullname" . }}
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.componentLabels" (dict "component" "web" "root" .) | nindent 4 }} app: {{ template "superset.name" . }}
{{- with .Values.supersetNode.deploymentLabels }} chart: {{ template "superset.chart" . }}
{{- toYaml . | nindent 4 }} release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
{{- if .Values.supersetNode.deploymentLabels }}
{{- toYaml .Values.supersetNode.deploymentLabels | nindent 4 }}
{{- end }} {{- end }}
{{- if .Values.supersetNode.deploymentAnnotations }} {{- if .Values.supersetNode.deploymentAnnotations }}
annotations: {{- toYaml .Values.supersetNode.deploymentAnnotations | nindent 4 }} annotations: {{- toYaml .Values.supersetNode.deploymentAnnotations | nindent 4 }}
@@ -61,14 +67,15 @@ spec:
{{- toYaml .Values.supersetNode.podAnnotations | nindent 8 }} {{- toYaml .Values.supersetNode.podAnnotations | nindent 8 }}
{{- end }} {{- end }}
labels: labels:
{{- include "supersetNode.selectorLabels" . | nindent 8 }} app: {{ template "superset.name" . }}
release: {{ .Release.Name }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 8 }}
{{- end }}
{{- if .Values.supersetNode.podLabels }} {{- if .Values.supersetNode.podLabels }}
{{- toYaml .Values.supersetNode.podLabels | nindent 8 }} {{- toYaml .Values.supersetNode.podLabels | nindent 8 }}
{{- end }} {{- end }}
spec: spec:
{{- if .Values.supersetNode.deploymentAdditionalPodSpec }}
{{- tpl (toYaml .Values.supersetNode.deploymentAdditionalPodSpec) . | nindent 6 }}
{{- end }}
{{- if or (.Values.serviceAccount.create) (.Values.serviceAccountName) }} {{- if or (.Values.serviceAccount.create) (.Values.serviceAccountName) }}
serviceAccountName: {{ template "superset.serviceAccountName" . }} serviceAccountName: {{ template "superset.serviceAccountName" . }}
{{- end }} {{- end }}

View File

@@ -23,7 +23,13 @@ kind: HorizontalPodAutoscaler
metadata: metadata:
name: {{ include "superset.fullname" . }}-hpa name: {{ include "superset.fullname" . }}-hpa
labels: labels:
{{- include "superset.labels" . | nindent 4 }} app: {{ template "superset.name" . }}
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
spec: spec:
scaleTargetRef: scaleTargetRef:
apiVersion: apps/v1 apiVersion: apps/v1

View File

@@ -23,7 +23,13 @@ kind: HorizontalPodAutoscaler
metadata: metadata:
name: {{ include "superset.fullname" . }}-hpa-worker name: {{ include "superset.fullname" . }}-hpa-worker
labels: labels:
{{- include "superset.labels" . | nindent 4 }} app: {{ template "superset.name" . }}
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
spec: spec:
scaleTargetRef: scaleTargetRef:
apiVersion: apps/v1 apiVersion: apps/v1

View File

@@ -25,7 +25,13 @@ metadata:
name: {{ $fullName }} name: {{ $fullName }}
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.componentLabels" (dict "component" "ingress" "root" .) | nindent 4 }} app: {{ template "superset.name" . }}
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
{{- with .Values.ingress.annotations }} {{- with .Values.ingress.annotations }}
annotations: {{- toYaml . | nindent 4 }} annotations: {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}

View File

@@ -24,7 +24,13 @@ metadata:
name: {{ template "superset.fullname" . }}-init-db name: {{ template "superset.fullname" . }}-init-db
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.componentLabels" (dict "component" "init" "root" .) | nindent 4 }} app: {{ template "superset.name" . }}
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
{{- if .Values.init.jobAnnotations }} {{- if .Values.init.jobAnnotations }}
annotations: {{- toYaml .Values.init.jobAnnotations | nindent 4 }} annotations: {{- toYaml .Values.init.jobAnnotations | nindent 4 }}
{{- end }} {{- end }}
@@ -35,19 +41,16 @@ spec:
{{- if .Values.init.podAnnotations }} {{- if .Values.init.podAnnotations }}
annotations: {{- toYaml .Values.init.podAnnotations | nindent 8 }} annotations: {{- toYaml .Values.init.podAnnotations | nindent 8 }}
{{- end }} {{- end }}
{{- if or .Values.extraLabels .Values.init.podLabels }}
labels: labels:
{{- include "superset.componentSelectorLabels" (dict "component" "init" "root" .) | nindent 8 }}
job: {{ template "superset.fullname" . }}-init-db
{{- if .Values.extraLabels }} {{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 8 }} {{- toYaml .Values.extraLabels | nindent 8 }}
{{- end }} {{- end }}
{{- if .Values.init.podLabels }} {{- if .Values.init.podLabels }}
{{- toYaml .Values.init.podLabels | nindent 8 }} {{- toYaml .Values.init.podLabels | nindent 8 }}
{{- end }} {{- end }}
spec:
{{- if .Values.init.additionalPodSpec }}
{{- tpl (toYaml .Values.init.additionalPodSpec) . | nindent 6 }}
{{- end }} {{- end }}
spec:
{{- if or (.Values.serviceAccount.create) (.Values.serviceAccountName) }} {{- if or (.Values.serviceAccount.create) (.Values.serviceAccountName) }}
serviceAccountName: {{ template "superset.serviceAccountName" . }} serviceAccountName: {{ template "superset.serviceAccountName" . }}
{{- end }} {{- end }}

View File

@@ -27,7 +27,13 @@ kind: PodDisruptionBudget
metadata: metadata:
name: {{ include "superset.fullname" $ }}-celerybeat-pdb name: {{ include "superset.fullname" $ }}-celerybeat-pdb
labels: labels:
{{- include "superset.componentLabels" (dict "component" "celerybeat" "root" $) | nindent 4 }} app: {{ template "superset.name" $ }}-celerybeat
chart: {{ template "superset.chart" $ }}
release: {{ $.Release.Name }}
heritage: {{ $.Release.Service }}
{{- if $.Values.extraLabels }}
{{- toYaml $.Values.extraLabels | nindent 4 }}
{{- end }}
spec: spec:
{{- if .minAvailable }} {{- if .minAvailable }}
minAvailable: {{ .minAvailable }} minAvailable: {{ .minAvailable }}

View File

@@ -27,7 +27,13 @@ kind: PodDisruptionBudget
metadata: metadata:
name: {{ include "superset.fullname" $ }}-flower-pdb name: {{ include "superset.fullname" $ }}-flower-pdb
labels: labels:
{{- include "superset.componentLabels" (dict "component" "flower" "root" $) | nindent 4 }} app: {{ template "superset.name" $ }}-flower
chart: {{ template "superset.chart" $ }}
release: {{ $.Release.Name }}
heritage: {{ $.Release.Service }}
{{- if $.Values.extraLabels }}
{{- toYaml $.Values.extraLabels | nindent 4 }}
{{- end }}
spec: spec:
{{- if .minAvailable }} {{- if .minAvailable }}
minAvailable: {{ .minAvailable }} minAvailable: {{ .minAvailable }}

View File

@@ -27,7 +27,13 @@ kind: PodDisruptionBudget
metadata: metadata:
name: {{ include "superset.fullname" $ }}-worker-pdb name: {{ include "superset.fullname" $ }}-worker-pdb
labels: labels:
{{- include "superset.componentLabels" (dict "component" "worker" "root" $) | nindent 4 }} app: {{ template "superset.name" $ }}-worker
chart: {{ template "superset.chart" $ }}
release: {{ $.Release.Name }}
heritage: {{ $.Release.Service }}
{{- if $.Values.extraLabels }}
{{- toYaml $.Values.extraLabels | nindent 4 }}
{{- end }}
spec: spec:
{{- if .minAvailable }} {{- if .minAvailable }}
minAvailable: {{ .minAvailable }} minAvailable: {{ .minAvailable }}

View File

@@ -27,7 +27,13 @@ kind: PodDisruptionBudget
metadata: metadata:
name: {{ include "superset.fullname" $ }}-ws-pdb name: {{ include "superset.fullname" $ }}-ws-pdb
labels: labels:
{{- include "superset.componentLabels" (dict "component" "websocket" "root" $) | nindent 4 }} app: {{ template "superset.name" $ }}-ws
chart: {{ template "superset.chart" $ }}
release: {{ $.Release.Name }}
heritage: {{ $.Release.Service }}
{{- if $.Values.extraLabels }}
{{- toYaml $.Values.extraLabels | nindent 4 }}
{{- end }}
spec: spec:
{{- if .minAvailable }} {{- if .minAvailable }}
minAvailable: {{ .minAvailable }} minAvailable: {{ .minAvailable }}

View File

@@ -27,7 +27,13 @@ kind: PodDisruptionBudget
metadata: metadata:
name: {{ include "superset.fullname" $ }}-pdb name: {{ include "superset.fullname" $ }}-pdb
labels: labels:
{{- include "superset.componentLabels" (dict "component" "web" "root" $) | nindent 4 }} app: {{ template "superset.name" $ }}
chart: {{ template "superset.chart" $ }}
release: {{ $.Release.Name }}
heritage: {{ $.Release.Service }}
{{- if $.Values.extraLabels }}
{{- toYaml $.Values.extraLabels | nindent 4 }}
{{- end }}
spec: spec:
{{- if .minAvailable }} {{- if .minAvailable }}
minAvailable: {{ .minAvailable }} minAvailable: {{ .minAvailable }}

View File

@@ -23,7 +23,13 @@ metadata:
name: {{ template "superset.fullname" . }}-env name: {{ template "superset.fullname" . }}-env
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.labels" . | nindent 4 }} app: {{ template "superset.fullname" . }}
chart: {{ template "superset.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
type: Opaque type: Opaque
stringData: stringData:
REDIS_HOST: {{ tpl .Values.supersetNode.connections.redis_host . | quote }} REDIS_HOST: {{ tpl .Values.supersetNode.connections.redis_host . | quote }}
@@ -33,7 +39,6 @@ stringData:
{{- end }} {{- end }}
REDIS_PORT: {{ .Values.supersetNode.connections.redis_port | quote }} REDIS_PORT: {{ .Values.supersetNode.connections.redis_port | quote }}
REDIS_PROTO: {{ if .Values.supersetNode.connections.redis_ssl.enabled }}"rediss"{{ else }}"redis"{{ end }} REDIS_PROTO: {{ if .Values.supersetNode.connections.redis_ssl.enabled }}"rediss"{{ else }}"redis"{{ end }}
REDIS_DRIVER: {{ .Values.supersetNode.connections.redis_driver | quote }}
REDIS_DB: {{ .Values.supersetNode.connections.redis_cache_db | quote }} REDIS_DB: {{ .Values.supersetNode.connections.redis_cache_db | quote }}
REDIS_CELERY_DB: {{ .Values.supersetNode.connections.redis_celery_db | quote }} REDIS_CELERY_DB: {{ .Values.supersetNode.connections.redis_celery_db | quote }}
{{- if .Values.supersetNode.connections.redis_ssl.enabled }} {{- if .Values.supersetNode.connections.redis_ssl.enabled }}

View File

@@ -23,7 +23,13 @@ metadata:
name: {{ template "superset.fullname" . }}-config name: {{ template "superset.fullname" . }}-config
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.labels" . | nindent 4 }} app: {{ template "superset.fullname" . }}
chart: {{ template "superset.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
type: Opaque type: Opaque
stringData: stringData:
superset_config.py: | superset_config.py: |

View File

@@ -24,7 +24,13 @@ metadata:
name: "{{ template "superset.fullname" . }}-ws-config" name: "{{ template "superset.fullname" . }}-ws-config"
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.labels" . | nindent 4 }} app: {{ template "superset.fullname" . }}
chart: {{ template "superset.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
type: Opaque type: Opaque
stringData: stringData:
config.json: | config.json: |

View File

@@ -24,7 +24,13 @@ metadata:
name: "{{ template "superset.fullname" . }}-flower" name: "{{ template "superset.fullname" . }}-flower"
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.componentLabels" (dict "component" "flower" "root" .) | nindent 4 }} app: {{ template "superset.name" . }}
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
{{- with .Values.supersetCeleryFlower.service.annotations }} {{- with .Values.supersetCeleryFlower.service.annotations }}
annotations: {{- toYaml . | nindent 4 }} annotations: {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
@@ -39,7 +45,8 @@ spec:
nodePort: {{ .Values.supersetCeleryFlower.service.nodePort.http }} nodePort: {{ .Values.supersetCeleryFlower.service.nodePort.http }}
{{- end }} {{- end }}
selector: selector:
{{- include "supersetCeleryFlower.selectorLabels" . | nindent 4 }} app: {{ template "superset.name" . }}-flower
release: {{ .Release.Name }}
{{- if .Values.supersetCeleryFlower.service.loadBalancerIP }} {{- if .Values.supersetCeleryFlower.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.supersetCeleryFlower.service.loadBalancerIP }} loadBalancerIP: {{ .Values.supersetCeleryFlower.service.loadBalancerIP }}
{{- end }} {{- end }}

View File

@@ -24,7 +24,13 @@ metadata:
name: "{{ template "superset.fullname" . }}-ws" name: "{{ template "superset.fullname" . }}-ws"
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.componentLabels" (dict "component" "websocket" "root" .) | nindent 4 }} app: {{ template "superset.name" . }}
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
{{- with .Values.supersetWebsockets.service.annotations }} {{- with .Values.supersetWebsockets.service.annotations }}
annotations: {{- toYaml . | nindent 4 }} annotations: {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
@@ -39,7 +45,8 @@ spec:
nodePort: {{ .Values.supersetWebsockets.service.nodePort.http }} nodePort: {{ .Values.supersetWebsockets.service.nodePort.http }}
{{- end }} {{- end }}
selector: selector:
{{- include "supersetWebsockets.selectorLabels" . | nindent 4 }} app: "{{ template "superset.name" . }}-ws"
release: {{ .Release.Name }}
{{- if .Values.supersetWebsockets.service.loadBalancerIP }} {{- if .Values.supersetWebsockets.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.supersetWebsockets.service.loadBalancerIP }} loadBalancerIP: {{ .Values.supersetWebsockets.service.loadBalancerIP }}
{{- end }} {{- end }}

View File

@@ -23,7 +23,13 @@ metadata:
name: {{ template "superset.fullname" . }} name: {{ template "superset.fullname" . }}
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.componentLabels" (dict "component" "web" "root" .) | nindent 4 }} app: {{ template "superset.name" . }}
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
{{- with .Values.service.annotations }} {{- with .Values.service.annotations }}
annotations: {{- toYaml . | nindent 4 }} annotations: {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
@@ -38,7 +44,8 @@ spec:
nodePort: {{ .Values.service.nodePort.http }} nodePort: {{ .Values.service.nodePort.http }}
{{- end }} {{- end }}
selector: selector:
{{- include "supersetNode.selectorLabels" . | nindent 4 }} app: {{ template "superset.name" . }}
release: {{ .Release.Name }}
{{- if .Values.service.loadBalancerIP }} {{- if .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }} loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }} {{- end }}

View File

@@ -24,11 +24,17 @@ metadata:
name: {{ include "superset.serviceAccountName" . }} name: {{ include "superset.serviceAccountName" . }}
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
labels: labels:
{{- include "superset.labels" . | nindent 4 }} app.kubernetes.io/name: {{ include "superset.name" . }}
helm.sh/chart: {{ include "superset.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if semverCompare "> 1.6" .Capabilities.KubeVersion.GitVersion }} {{- if semverCompare "> 1.6" .Capabilities.KubeVersion.GitVersion }}
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
{{- end }} {{- end }}
addonmanager.kubernetes.io/mode: Reconcile addonmanager.kubernetes.io/mode: Reconcile
{{- if .Values.extraLabels }}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
{{- if .Values.serviceAccount.annotations }} {{- if .Values.serviceAccount.annotations }}
annotations: {{- toYaml .Values.serviceAccount.annotations | nindent 4 }} annotations: {{- toYaml .Values.serviceAccount.annotations | nindent 4 }}
{{- end }} {{- end }}

View File

@@ -1,520 +0,0 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
suite: Label Consistency Tests
templates:
- deployment.yaml
- deployment-worker.yaml
- deployment-beat.yaml
- deployment-flower.yaml
- deployment-ws.yaml
- service.yaml
- service-ws.yaml
- service-flower.yaml
- init-job.yaml
- ingress.yaml
- configmap-superset.yaml
- secret-superset-config.yaml
- secret-ws.yaml
- pdb.yaml
- pdb-worker.yaml
- pdb-beat.yaml
- pdb-flower.yaml
- pdb-ws.yaml
# These tests validate that Kubernetes recommended labels are consistently applied
# across all chart resources per https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/
#
# Required Labels (app.kubernetes.io/):
# - name: The name of the application
# - instance: A unique name identifying the instance of an application
# - version: The current version of the application
# - component: The component within the architecture
# - part-of: The name of a higher level application this one is part of
# - managed-by: The tool being used to manage the operation of an application
#
# Helm-specific Labels:
# - helm.sh/chart: The chart name and version
tests:
# =============================================================================
# Main Deployment Labels
# =============================================================================
- it: should have all recommended labels on main deployment
template: deployment.yaml
asserts:
- isNotNull:
path: metadata.labels["app.kubernetes.io/name"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/instance"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/version"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/managed-by"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/part-of"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/component"]
- isNotNull:
path: metadata.labels["helm.sh/chart"]
- it: should have correct component label on main deployment
template: deployment.yaml
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: web
- it: should have part-of label set to superset on main deployment
template: deployment.yaml
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/part-of"]
value: superset
# =============================================================================
# Worker Deployment Labels
# =============================================================================
- it: should have all recommended labels on worker deployment
template: deployment-worker.yaml
asserts:
- isNotNull:
path: metadata.labels["app.kubernetes.io/name"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/instance"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/version"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/managed-by"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/part-of"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/component"]
- it: should have correct component label on worker deployment
template: deployment-worker.yaml
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: worker
# =============================================================================
# Celery Beat Deployment Labels
# =============================================================================
- it: should have all recommended labels on celerybeat deployment
template: deployment-beat.yaml
set:
supersetCeleryBeat.enabled: true
asserts:
- isNotNull:
path: metadata.labels["app.kubernetes.io/name"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/instance"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/component"]
- it: should have correct component label on celerybeat deployment
template: deployment-beat.yaml
set:
supersetCeleryBeat.enabled: true
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: celerybeat
# =============================================================================
# Flower Deployment Labels
# =============================================================================
- it: should have all recommended labels on flower deployment
template: deployment-flower.yaml
set:
supersetCeleryFlower.enabled: true
asserts:
- isNotNull:
path: metadata.labels["app.kubernetes.io/name"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/instance"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/component"]
- it: should have correct component label on flower deployment
template: deployment-flower.yaml
set:
supersetCeleryFlower.enabled: true
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: flower
# =============================================================================
# WebSocket Deployment Labels
# =============================================================================
- it: should have all recommended labels on websocket deployment
template: deployment-ws.yaml
set:
supersetWebsockets.enabled: true
supersetWebsockets.config.jwtSecret: "test-secret-for-unit-test"
asserts:
- isNotNull:
path: metadata.labels["app.kubernetes.io/name"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/instance"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/component"]
- it: should have correct component label on websocket deployment
template: deployment-ws.yaml
set:
supersetWebsockets.enabled: true
supersetWebsockets.config.jwtSecret: "test-secret-for-unit-test"
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: websocket
# =============================================================================
# Service Labels
# =============================================================================
- it: should have all recommended labels on main service
template: service.yaml
asserts:
- isNotNull:
path: metadata.labels["app.kubernetes.io/name"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/instance"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/component"]
- it: should have correct component label on main service
template: service.yaml
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: web
- it: should have all recommended labels on websocket service
template: service-ws.yaml
set:
supersetWebsockets.enabled: true
supersetWebsockets.config.jwtSecret: "test-secret-for-unit-test"
asserts:
- isNotNull:
path: metadata.labels["app.kubernetes.io/name"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/instance"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/component"]
- it: should have correct component label on websocket service
template: service-ws.yaml
set:
supersetWebsockets.enabled: true
supersetWebsockets.config.jwtSecret: "test-secret-for-unit-test"
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: websocket
- it: should have all recommended labels on flower service
template: service-flower.yaml
set:
supersetCeleryFlower.enabled: true
asserts:
- isNotNull:
path: metadata.labels["app.kubernetes.io/name"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/instance"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/component"]
- it: should have correct component label on flower service
template: service-flower.yaml
set:
supersetCeleryFlower.enabled: true
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: flower
# =============================================================================
# Init Job Labels
# =============================================================================
- it: should have all recommended labels on init job
template: init-job.yaml
set:
init.enabled: true
init.createAdmin: true
init.adminUser.password: "test-password"
asserts:
- isNotNull:
path: metadata.labels["app.kubernetes.io/name"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/instance"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/component"]
- it: should have correct component label on init job
template: init-job.yaml
set:
init.enabled: true
init.createAdmin: true
init.adminUser.password: "test-password"
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: init
# =============================================================================
# Ingress Labels
# =============================================================================
- it: should have all recommended labels on ingress
template: ingress.yaml
set:
ingress.enabled: true
ingress.hosts:
- host: superset.example.com
paths:
- path: /
pathType: Prefix
asserts:
- isNotNull:
path: metadata.labels["app.kubernetes.io/name"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/instance"]
- isNotNull:
path: metadata.labels["app.kubernetes.io/component"]
- it: should have correct component label on ingress
template: ingress.yaml
set:
ingress.enabled: true
ingress.hosts:
- host: superset.example.com
paths:
- path: /
pathType: Prefix
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: ingress
# =============================================================================
# Selector Label Consistency
#
# These use value assertions (not isNotNull) on purpose: a missing/misscoped
# release name renders as the string "<no value>", which is non-null and would
# silently pass isNotNull. Asserting the concrete value catches that class of
# bug, and asserting the pod template labels equal the selector guards the
# immutable spec.selector.matchLabels <-> pod label invariant.
# =============================================================================
- it: should set selector matchLabels to concrete values on main deployment
template: deployment.yaml
asserts:
- equal:
path: spec.selector.matchLabels["app.kubernetes.io/name"]
value: superset
- equal:
path: spec.selector.matchLabels["app.kubernetes.io/instance"]
value: RELEASE-NAME
- equal:
path: spec.selector.matchLabels["app.kubernetes.io/component"]
value: web
- it: should match pod template labels to the selector on main deployment
template: deployment.yaml
asserts:
- equal:
path: spec.template.metadata.labels["app.kubernetes.io/name"]
value: superset
- equal:
path: spec.template.metadata.labels["app.kubernetes.io/instance"]
value: RELEASE-NAME
- equal:
path: spec.template.metadata.labels["app.kubernetes.io/component"]
value: web
- it: should set selector matchLabels to concrete values on worker deployment
template: deployment-worker.yaml
asserts:
- equal:
path: spec.selector.matchLabels["app.kubernetes.io/instance"]
value: RELEASE-NAME
- equal:
path: spec.selector.matchLabels["app.kubernetes.io/component"]
value: worker
- it: should match pod template labels to the selector on worker deployment
template: deployment-worker.yaml
asserts:
- equal:
path: spec.template.metadata.labels["app.kubernetes.io/instance"]
value: RELEASE-NAME
- equal:
path: spec.template.metadata.labels["app.kubernetes.io/component"]
value: worker
# =============================================================================
# Extra Labels Support
# =============================================================================
- it: should include extraLabels when specified
template: deployment.yaml
set:
extraLabels:
custom-label: custom-value
environment: production
asserts:
- equal:
path: metadata.labels.custom-label
value: custom-value
- equal:
path: metadata.labels.environment
value: production
- it: should include extraLabels in service
template: service.yaml
set:
extraLabels:
custom-label: custom-value
asserts:
- equal:
path: metadata.labels.custom-label
value: custom-value
# =============================================================================
# ConfigMap / Secret Labels
# =============================================================================
- it: should have recommended labels on extra-config configmap
template: configmap-superset.yaml
set:
extraConfigs:
custom.py: "FOO = 1"
asserts:
- isNotNull:
path: metadata.labels["app.kubernetes.io/name"]
- equal:
path: metadata.labels["app.kubernetes.io/instance"]
value: RELEASE-NAME
- isNotNull:
path: metadata.labels["app.kubernetes.io/managed-by"]
- equal:
path: metadata.labels["app.kubernetes.io/part-of"]
value: superset
- it: should have recommended labels on superset config secret
template: secret-superset-config.yaml
asserts:
- isNotNull:
path: metadata.labels["app.kubernetes.io/name"]
- equal:
path: metadata.labels["app.kubernetes.io/instance"]
value: RELEASE-NAME
- equal:
path: metadata.labels["app.kubernetes.io/part-of"]
value: superset
- it: should have recommended labels on websocket config secret
template: secret-ws.yaml
set:
supersetWebsockets.enabled: true
asserts:
- isNotNull:
path: metadata.labels["app.kubernetes.io/name"]
- equal:
path: metadata.labels["app.kubernetes.io/instance"]
value: RELEASE-NAME
# =============================================================================
# PodDisruptionBudget Labels (metadata must match the selector)
# =============================================================================
- it: should have recommended labels and matching selector on main pdb
template: pdb.yaml
set:
supersetNode.podDisruptionBudget.enabled: true
supersetNode.podDisruptionBudget.maxUnavailable: null
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/instance"]
value: RELEASE-NAME
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: web
- equal:
path: spec.selector.matchLabels["app.kubernetes.io/instance"]
value: RELEASE-NAME
- equal:
path: spec.selector.matchLabels["app.kubernetes.io/component"]
value: web
- it: should set correct component on worker pdb
template: pdb-worker.yaml
set:
supersetWorker.podDisruptionBudget.enabled: true
supersetWorker.podDisruptionBudget.maxUnavailable: null
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: worker
- equal:
path: spec.selector.matchLabels["app.kubernetes.io/component"]
value: worker
- it: should set correct component on celerybeat pdb
template: pdb-beat.yaml
set:
supersetCeleryBeat.podDisruptionBudget.enabled: true
supersetCeleryBeat.podDisruptionBudget.maxUnavailable: null
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: celerybeat
- it: should set correct component on flower pdb
template: pdb-flower.yaml
set:
supersetCeleryFlower.podDisruptionBudget.enabled: true
supersetCeleryFlower.podDisruptionBudget.maxUnavailable: null
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: flower
- it: should set correct component on websocket pdb
template: pdb-ws.yaml
set:
supersetWebsockets.enabled: true
supersetWebsockets.podDisruptionBudget.enabled: true
supersetWebsockets.podDisruptionBudget.maxUnavailable: null
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/component"]
value: websocket
- equal:
path: spec.selector.matchLabels["app.kubernetes.io/component"]
value: websocket
- it: should use recommended labels on init job pod template
template: init-job.yaml
set:
init.enabled: true
asserts:
- equal:
path: spec.template.metadata.labels["app.kubernetes.io/instance"]
value: RELEASE-NAME
- equal:
path: spec.template.metadata.labels["app.kubernetes.io/component"]
value: init
- isNotNull:
path: spec.template.metadata.labels.job

View File

@@ -283,7 +283,6 @@ supersetNode:
redis_ssl: redis_ssl:
enabled: false enabled: false
ssl_cert_reqs: CERT_NONE ssl_cert_reqs: CERT_NONE
redis_driver: ""
# You need to change below configuration incase bringing own PostgresSQL instance and also set postgresql.enabled:false # You need to change below configuration incase bringing own PostgresSQL instance and also set postgresql.enabled:false
# -- Database type for Superset metadata (Supported types: "postgresql", "mysql") # -- Database type for Superset metadata (Supported types: "postgresql", "mysql")
db_type: "postgresql" db_type: "postgresql"
@@ -335,8 +334,6 @@ supersetNode:
deploymentAnnotations: {} deploymentAnnotations: {}
# -- Labels to be added to supersetNode deployment # -- Labels to be added to supersetNode deployment
deploymentLabels: {} deploymentLabels: {}
# -- Custom pod spec to be added to supersetNode deployment
deploymentAdditionalPodSpec: {}
# -- Affinity to be added to supersetNode deployment # -- Affinity to be added to supersetNode deployment
affinity: {} affinity: {}
# -- TopologySpreadConstrains to be added to supersetNode deployments # -- TopologySpreadConstrains to be added to supersetNode deployments
@@ -462,8 +459,6 @@ supersetWorker:
deploymentAnnotations: {} deploymentAnnotations: {}
# -- Labels to be added to supersetWorker deployment # -- Labels to be added to supersetWorker deployment
deploymentLabels: {} deploymentLabels: {}
# -- Custom pod spec to be added to supersetWorker deployment
deploymentAdditionalPodSpec: {}
# -- Affinity to be added to supersetWorker deployment # -- Affinity to be added to supersetWorker deployment
affinity: {} affinity: {}
# -- TopologySpreadConstrains to be added to supersetWorker deployments # -- TopologySpreadConstrains to be added to supersetWorker deployments
@@ -570,8 +565,6 @@ supersetCeleryBeat:
extraContainers: [] extraContainers: []
# -- Annotations to be added to supersetCeleryBeat deployment # -- Annotations to be added to supersetCeleryBeat deployment
deploymentAnnotations: {} deploymentAnnotations: {}
# -- Custom pod spec to be added to supersetCeleryBeat deployment
deploymentAdditionalPodSpec: {}
# -- Affinity to be added to supersetCeleryBeat deployment # -- Affinity to be added to supersetCeleryBeat deployment
affinity: {} affinity: {}
# -- TopologySpreadConstrains to be added to supersetCeleryBeat deployments # -- TopologySpreadConstrains to be added to supersetCeleryBeat deployments
@@ -687,8 +680,6 @@ supersetCeleryFlower:
extraContainers: [] extraContainers: []
# -- Annotations to be added to supersetCeleryFlower deployment # -- Annotations to be added to supersetCeleryFlower deployment
deploymentAnnotations: {} deploymentAnnotations: {}
# -- Custom pod spec to be added to supersetCeleryFlower deployment
deploymentAdditionalPodSpec: {}
# -- Affinity to be added to supersetCeleryFlower deployment # -- Affinity to be added to supersetCeleryFlower deployment
affinity: {} affinity: {}
# -- TopologySpreadConstrains to be added to supersetCeleryFlower deployments # -- TopologySpreadConstrains to be added to supersetCeleryFlower deployments
@@ -766,8 +757,6 @@ supersetWebsockets:
# -- Launch additional containers into supersetWebsockets pods # -- Launch additional containers into supersetWebsockets pods
extraContainers: [] extraContainers: []
deploymentAnnotations: {} deploymentAnnotations: {}
# -- Custom pod spec to be added to supersetWebsockets deployment
deploymentAdditionalPodSpec: {}
# -- Affinity to be added to supersetWebsockets deployment # -- Affinity to be added to supersetWebsockets deployment
affinity: {} affinity: {}
# -- TopologySpreadConstrains to be added to supersetWebsockets deployments # -- TopologySpreadConstrains to be added to supersetWebsockets deployments
@@ -830,8 +819,6 @@ init:
jobAnnotations: jobAnnotations:
"helm.sh/hook": post-install,post-upgrade "helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": "before-hook-creation" "helm.sh/hook-delete-policy": "before-hook-creation"
# -- Custom pod spec to be added to init job
additionalPodSpec: {}
loadExamples: false loadExamples: false
createAdmin: true createAdmin: true
adminUser: adminUser:

View File

@@ -77,7 +77,7 @@ dependencies = [
# Flask-AppBuilder workaround. Tracking issue: # Flask-AppBuilder workaround. Tracking issue:
# https://github.com/apache/superset/issues/33162 # https://github.com/apache/superset/issues/33162
"marshmallow>=3.0, <5", "marshmallow>=3.0, <5",
"marshmallow-union>=0.1.15.post1", "marshmallow-union>=0.1",
"msgpack>=1.2.0, <1.3", "msgpack>=1.2.0, <1.3",
"nh3>=0.3.5, <0.4", "nh3>=0.3.5, <0.4",
"numpy>1.23.5, <2.3", "numpy>1.23.5, <2.3",
@@ -102,13 +102,13 @@ dependencies = [
"PyJWT>=2.4.0, <3.0", "PyJWT>=2.4.0, <3.0",
"redis>=5.0.0, <6.0", "redis>=5.0.0, <6.0",
"rison>=2.0.0, <3.0", "rison>=2.0.0, <3.0",
"selenium>=4.45.0, <5.0", "selenium>=4.44.0, <5.0",
"shillelagh[gsheetsapi]>=1.4.4, <2.0", "shillelagh[gsheetsapi]>=1.4.4, <2.0",
"sshtunnel>=0.4.0, <0.5", "sshtunnel>=0.4.0, <0.5",
"simplejson>=4.1.1", "simplejson>=4.1.1",
"slack_sdk>=3.42.0, <4", "slack_sdk>=3.19.0, <4",
"sqlalchemy>=1.4, <2", "sqlalchemy>=1.4, <2",
"sqlalchemy-utils>=0.42.1, <0.43", # expanding lowerbound to work with pydoris "sqlalchemy-utils>=0.38.0, <0.43", # expanding lowerbound to work with pydoris
"sqlglot>=30.8.0, <31", "sqlglot>=30.8.0, <31",
# newer pandas needs 0.9+ # newer pandas needs 0.9+
"tabulate>=0.10.0, <1.0", "tabulate>=0.10.0, <1.0",
@@ -147,14 +147,14 @@ denodo = ["denodo-sqlalchemy>=2.0.5,<2.1.0"]
dremio = ["sqlalchemy-dremio>=1.2.1, <4"] dremio = ["sqlalchemy-dremio>=1.2.1, <4"]
drill = ["sqlalchemy-drill>=1.1.10, <2"] drill = ["sqlalchemy-drill>=1.1.10, <2"]
druid = ["pydruid>=0.6.5,<0.7"] druid = ["pydruid>=0.6.5,<0.7"]
duckdb = ["duckdb>=1.5.4,<2", "duckdb-engine>=0.17.0"] duckdb = ["duckdb>=1.5.2,<2", "duckdb-engine>=0.17.0"]
dynamodb = ["pydynamodb>=0.4.2"] dynamodb = ["pydynamodb>=0.4.2"]
solr = ["sqlalchemy-solr >= 0.2.4.3"] solr = ["sqlalchemy-solr >= 0.2.4.3"]
elasticsearch = ["elasticsearch-dbapi>=0.2.13, <0.3.0"] elasticsearch = ["elasticsearch-dbapi>=0.2.13, <0.3.0"]
exasol = ["sqlalchemy-exasol>=2.4.0, <8.0"] exasol = ["sqlalchemy-exasol>=2.4.0, <8.0"]
excel = ["xlrd>=2.0.2, <2.1"] excel = ["xlrd>=2.0.2, <2.1"]
fastmcp = [ fastmcp = [
"fastmcp>=3.4.2,<4.0", "fastmcp>=3.2.4,<4.0",
# tiktoken backs the response-size-guard token estimator. Without # tiktoken backs the response-size-guard token estimator. Without
# it, the middleware falls back to a coarser character-based # it, the middleware falls back to a coarser character-based
# heuristic that under-counts JSON-heavy MCP responses. # heuristic that under-counts JSON-heavy MCP responses.
@@ -197,7 +197,7 @@ redshift = ["sqlalchemy-redshift>=0.8.1, <0.9"]
risingwave = ["sqlalchemy-risingwave"] risingwave = ["sqlalchemy-risingwave"]
shillelagh = ["shillelagh[all]>=1.4.4, <2"] shillelagh = ["shillelagh[all]>=1.4.4, <2"]
singlestore = ["sqlalchemy-singlestoredb>=1.1.1, <2"] singlestore = ["sqlalchemy-singlestoredb>=1.1.1, <2"]
snowflake = ["snowflake-sqlalchemy>=1.10.2, <2"] snowflake = ["snowflake-sqlalchemy>=1.2.4, <2"]
sqlite = ["syntaqlite>=0.1.0,<0.5.0"] sqlite = ["syntaqlite>=0.1.0,<0.5.0"]
spark = [ spark = [
"pyhive[hive]>=0.6.5;python_version<'3.11'", "pyhive[hive]>=0.6.5;python_version<'3.11'",
@@ -206,13 +206,13 @@ spark = [
"thrift>=0.23.0, <1", "thrift>=0.23.0, <1",
] ]
tdengine = [ tdengine = [
"taospy>=2.8.9", "taospy>=2.7.21",
"taos-ws-py>=0.6.9" "taos-ws-py>=0.6.9"
] ]
teradata = ["teradatasql>=16.20.0.23"] teradata = ["teradatasql>=16.20.0.23"]
thumbnails = [] # deprecated, will be removed in 7.0 thumbnails = [] # deprecated, will be removed in 7.0
vertica = ["sqlalchemy-vertica-python>= 0.6.3, < 0.7"] vertica = ["sqlalchemy-vertica-python>= 0.6.3, < 0.7"]
netezza = ["nzalchemy>=11.0.2, < 11.2"] netezza = ["nzalchemy>=11.0.2"]
starrocks = ["starrocks>=1.3.3, <2"] starrocks = ["starrocks>=1.3.3, <2"]
doris = ["pydoris>=1.0.0, <2.0.0"] doris = ["pydoris>=1.0.0, <2.0.0"]
oceanbase = ["oceanbase_py>=0.0.1.2"] oceanbase = ["oceanbase_py>=0.0.1.2"]
@@ -375,7 +375,6 @@ select = [
ignore = [ ignore = [
"S101", "S101",
"PT001", # pytest-fixture-incorrect-parentheses-style: different ruff versions disagree
"PT006", "PT006",
"T201", "T201",
"N999", "N999",

View File

@@ -43,5 +43,5 @@ filterwarnings =
# error:The ``declarative_base\(\)`` function is now available:sqlalchemy.exc.RemovedIn20Warning # error:The ``declarative_base\(\)`` function is now available:sqlalchemy.exc.RemovedIn20Warning
# error:The Engine.execute\(\) method is considered legacy:sqlalchemy.exc.RemovedIn20Warning # error:The Engine.execute\(\) method is considered legacy:sqlalchemy.exc.RemovedIn20Warning
error:The legacy calling style of select\(\) is deprecated:sqlalchemy.exc.RemovedIn20Warning error:The legacy calling style of select\(\) is deprecated:sqlalchemy.exc.RemovedIn20Warning
error:The "whens" argument to case:sqlalchemy.exc.RemovedIn20Warning # error:The "whens" argument to case:sqlalchemy.exc.RemovedIn20Warning
# error:"User" object is being merged into a Session:sqlalchemy.exc.RemovedIn20Warning # error:"User" object is being merged into a Session:sqlalchemy.exc.RemovedIn20Warning

View File

@@ -236,7 +236,7 @@ marshmallow-sqlalchemy==1.5.0
# via # via
# -r requirements/base.in # -r requirements/base.in
# flask-appbuilder # flask-appbuilder
marshmallow-union==0.1.15.post1 marshmallow-union==0.1.15
# via apache-superset (pyproject.toml) # via apache-superset (pyproject.toml)
mdurl==0.1.2 mdurl==0.1.2
# via markdown-it-py # via markdown-it-py
@@ -315,7 +315,7 @@ pygeohash==3.2.2
# via apache-superset (pyproject.toml) # via apache-superset (pyproject.toml)
pygments==2.20.0 pygments==2.20.0
# via rich # via rich
pyjwt==2.13.0 pyjwt==2.12.0
# via # via
# apache-superset (pyproject.toml) # apache-superset (pyproject.toml)
# flask-appbuilder # flask-appbuilder
@@ -375,7 +375,7 @@ rpds-py==0.25.0
# via # via
# jsonschema # jsonschema
# referencing # referencing
selenium==4.45.0 selenium==4.44.0
# via apache-superset (pyproject.toml) # via apache-superset (pyproject.toml)
setuptools==80.9.0 setuptools==80.9.0
# via -r requirements/base.in # via -r requirements/base.in
@@ -389,7 +389,7 @@ six==1.17.0
# python-dateutil # python-dateutil
# rfc3339-validator # rfc3339-validator
# wtforms-json # wtforms-json
slack-sdk==3.42.0 slack-sdk==3.35.0
# via apache-superset (pyproject.toml) # via apache-superset (pyproject.toml)
sniffio==1.3.1 sniffio==1.3.1
# via trio # via trio
@@ -405,7 +405,7 @@ sqlalchemy==1.4.54
# marshmallow-sqlalchemy # marshmallow-sqlalchemy
# shillelagh # shillelagh
# sqlalchemy-utils # sqlalchemy-utils
sqlalchemy-utils==0.42.1 sqlalchemy-utils==0.42.0
# via # via
# apache-superset (pyproject.toml) # apache-superset (pyproject.toml)
# apache-superset-core # apache-superset-core

View File

@@ -53,7 +53,7 @@ attrs==25.3.0
# requests-cache # requests-cache
# trio # trio
authlib==1.6.12 authlib==1.6.12
# via fastmcp-slim # via fastmcp
babel==2.17.0 babel==2.17.0
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
@@ -184,7 +184,6 @@ cryptography==48.0.1
# apache-superset # apache-superset
# authlib # authlib
# google-auth # google-auth
# joserfc
# paramiko # paramiko
# pyjwt # pyjwt
# pyopenssl # pyopenssl
@@ -192,7 +191,7 @@ cryptography==48.0.1
cycler==0.12.1 cycler==0.12.1
# via matplotlib # via matplotlib
cyclopts==4.2.4 cyclopts==4.2.4
# via fastmcp-slim # via fastmcp
db-dtypes==1.3.1 db-dtypes==1.3.1
# via pandas-gbq # via pandas-gbq
defusedxml==0.7.1 defusedxml==0.7.1
@@ -221,7 +220,7 @@ docstring-parser==0.17.0
# via cyclopts # via cyclopts
docutils==0.22.2 docutils==0.22.2
# via rich-rst # via rich-rst
duckdb==1.5.4 duckdb==1.5.3
# via # via
# apache-superset # apache-superset
# duckdb-engine # duckdb-engine
@@ -237,11 +236,9 @@ et-xmlfile==2.0.0
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# openpyxl # openpyxl
exceptiongroup==1.3.0 exceptiongroup==1.3.0
# via fastmcp-slim
fastmcp==3.4.2
# via apache-superset
fastmcp-slim==3.4.2
# via fastmcp # via fastmcp
fastmcp==3.2.4
# via apache-superset
filelock==3.20.3 filelock==3.20.3
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
@@ -385,7 +382,7 @@ greenlet==3.5.1
# shillelagh # shillelagh
# sqlalchemy # sqlalchemy
griffelib==2.0.2 griffelib==2.0.2
# via fastmcp-slim # via fastmcp
grpcio==1.81.1 grpcio==1.81.1
# via # via
# apache-superset # apache-superset
@@ -416,7 +413,7 @@ httpcore==1.0.9
# via httpx # via httpx
httpx==0.28.1 httpx==0.28.1
# via # via
# fastmcp-slim # fastmcp
# mcp # mcp
httpx-sse==0.4.1 httpx-sse==0.4.1
# via mcp # via mcp
@@ -475,14 +472,12 @@ jmespath==1.1.0
# via # via
# boto3 # boto3
# botocore # botocore
joserfc==1.7.2
# via fastmcp-slim
jsonpath-ng==1.8.0 jsonpath-ng==1.8.0
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# apache-superset # apache-superset
jsonref==1.1.0 jsonref==1.1.0
# via fastmcp-slim # via fastmcp
jsonschema==4.23.0 jsonschema==4.23.0
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
@@ -492,7 +487,7 @@ jsonschema==4.23.0
# openapi-spec-validator # openapi-spec-validator
jsonschema-path==0.3.4 jsonschema-path==0.3.4
# via # via
# fastmcp-slim # fastmcp
# openapi-spec-validator # openapi-spec-validator
jsonschema-specifications==2025.4.1 jsonschema-specifications==2025.4.1
# via # via
@@ -546,7 +541,7 @@ marshmallow-sqlalchemy==1.5.0
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# flask-appbuilder # flask-appbuilder
marshmallow-union==0.1.15.post1 marshmallow-union==0.1.15
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# apache-superset # apache-superset
@@ -555,7 +550,7 @@ matplotlib==3.9.0
mccabe==0.7.0 mccabe==0.7.0
# via pylint # via pylint
mcp==1.24.0 mcp==1.24.0
# via fastmcp-slim # via fastmcp
mdurl==0.1.2 mdurl==0.1.2
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
@@ -599,7 +594,7 @@ odfpy==1.4.1
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# pandas # pandas
openapi-pydantic==0.5.1 openapi-pydantic==0.5.1
# via fastmcp-slim # via fastmcp
openapi-schema-validator==0.6.3 openapi-schema-validator==0.6.3
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
@@ -611,7 +606,7 @@ openpyxl==3.1.5
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# pandas # pandas
opentelemetry-api==1.39.1 opentelemetry-api==1.39.1
# via fastmcp-slim # via fastmcp
ordered-set==4.1.0 ordered-set==4.1.0
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
@@ -632,7 +627,7 @@ packaging==25.0
# deprecation # deprecation
# docker # docker
# duckdb-engine # duckdb-engine
# fastmcp-slim # fastmcp
# google-cloud-bigquery # google-cloud-bigquery
# gunicorn # gunicorn
# limits # limits
@@ -677,7 +672,7 @@ pip==25.1.1
platformdirs==4.3.8 platformdirs==4.3.8
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# fastmcp-slim # fastmcp
# pylint # pylint
# requests-cache # requests-cache
# virtualenv # virtualenv
@@ -719,7 +714,7 @@ psutil==6.1.0
psycopg2-binary==2.9.12 psycopg2-binary==2.9.12
# via apache-superset # via apache-superset
py-key-value-aio==0.4.4 py-key-value-aio==0.4.4
# via fastmcp-slim # via fastmcp
pyarrow==24.0.0 pyarrow==24.0.0
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
@@ -746,7 +741,7 @@ pydantic==2.11.7
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# apache-superset # apache-superset
# apache-superset-core # apache-superset-core
# fastmcp-slim # fastmcp
# mcp # mcp
# openapi-pydantic # openapi-pydantic
# pydantic-settings # pydantic-settings
@@ -755,9 +750,7 @@ pydantic-core==2.33.2
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# pydantic # pydantic
pydantic-settings==2.10.1 pydantic-settings==2.10.1
# via # via mcp
# fastmcp-slim
# mcp
pydata-google-auth==1.9.0 pydata-google-auth==1.9.0
# via pandas-gbq # via pandas-gbq
pydruid==0.6.9 pydruid==0.6.9
@@ -776,7 +769,7 @@ pyhive==0.7.0
# via apache-superset # via apache-superset
pyinstrument==5.1.2 pyinstrument==5.1.2
# via apache-superset # via apache-superset
pyjwt==2.13.0 pyjwt==2.12.0
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# apache-superset # apache-superset
@@ -800,7 +793,7 @@ pyparsing==3.2.3
# apache-superset # apache-superset
# matplotlib # matplotlib
pyperclip==1.10.0 pyperclip==1.10.0
# via fastmcp-slim # via fastmcp
pysocks==1.7.1 pysocks==1.7.1
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
@@ -842,14 +835,12 @@ python-dotenv==1.2.2
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# apache-superset # apache-superset
# fastmcp-slim # fastmcp
# pydantic-settings # pydantic-settings
python-ldap==3.4.7 python-ldap==3.4.7
# via apache-superset # via apache-superset
python-multipart==0.0.29 python-multipart==0.0.29
# via # via mcp
# fastmcp-slim
# mcp
pytz==2025.2 pytz==2025.2
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
@@ -865,7 +856,7 @@ pyyaml==6.0.3
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# apache-superset # apache-superset
# apispec # apispec
# fastmcp-slim # fastmcp
# jsonschema-path # jsonschema-path
# pre-commit # pre-commit
redis==5.3.1 redis==5.3.1
@@ -908,7 +899,7 @@ rich==13.9.4
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# cyclopts # cyclopts
# fastmcp-slim # fastmcp
# flask-limiter # flask-limiter
# rich-rst # rich-rst
rich-rst==1.3.1 rich-rst==1.3.1
@@ -928,7 +919,7 @@ s3transfer==0.16.0
# via boto3 # via boto3
secretstorage==3.5.0 secretstorage==3.5.0
# via keyring # via keyring
selenium==4.45.0 selenium==4.44.0
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# apache-superset # apache-superset
@@ -957,7 +948,7 @@ six==1.17.0
# python-dateutil # python-dateutil
# rfc3339-validator # rfc3339-validator
# wtforms-json # wtforms-json
slack-sdk==3.42.0 slack-sdk==3.35.0
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# apache-superset # apache-superset
@@ -985,7 +976,7 @@ sqlalchemy==1.4.54
# sqlalchemy-utils # sqlalchemy-utils
sqlalchemy-bigquery==1.17.0 sqlalchemy-bigquery==1.17.0
# via apache-superset # via apache-superset
sqlalchemy-utils==0.42.1 sqlalchemy-utils==0.42.0
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# apache-superset # apache-superset
@@ -1004,10 +995,8 @@ sshtunnel==0.4.0
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# apache-superset # apache-superset
starlette==1.3.1 starlette==0.49.1
# via # via mcp
# fastmcp-slim
# mcp
statsd==4.0.1 statsd==4.0.1
# via apache-superset # via apache-superset
syntaqlite==0.4.2 syntaqlite==0.4.2
@@ -1046,7 +1035,6 @@ typing-extensions==4.15.0
# apache-superset-core # apache-superset-core
# cattrs # cattrs
# exceptiongroup # exceptiongroup
# fastmcp-slim
# grpcio # grpcio
# limits # limits
# mcp # mcp
@@ -1074,7 +1062,7 @@ tzdata==2025.2
tzlocal==5.2 tzlocal==5.2
# via trino # via trino
uncalled-for==0.2.0 uncalled-for==0.2.0
# via fastmcp-slim # via fastmcp
url-normalize==2.2.1 url-normalize==2.2.1
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
@@ -1089,7 +1077,7 @@ urllib3==2.7.0
# selenium # selenium
uvicorn==0.37.0 uvicorn==0.37.0
# via # via
# fastmcp-slim # fastmcp
# mcp # mcp
vine==5.1.0 vine==5.1.0
# via # via
@@ -1105,7 +1093,7 @@ watchdog==6.0.0
# apache-superset # apache-superset
# apache-superset-extensions-cli # apache-superset-extensions-cli
watchfiles==1.1.1 watchfiles==1.1.1
# via fastmcp-slim # via fastmcp
wcwidth==0.2.13 wcwidth==0.2.13
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
@@ -1115,7 +1103,7 @@ websocket-client==1.8.0
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt
# selenium # selenium
websockets==15.0.1 websockets==15.0.1
# via fastmcp-slim # via fastmcp
werkzeug==3.1.6 werkzeug==3.1.6
# via # via
# -c requirements/base-constraint.txt # -c requirements/base-constraint.txt

View File

@@ -91,28 +91,22 @@ _ASF_LICENSE_HEADER = """\
LANGUAGE_NAMES: dict[str, str] = { LANGUAGE_NAMES: dict[str, str] = {
"ar": "Arabic", "ar": "Arabic",
"ca": "Catalan", "ca": "Catalan",
"cs": "Czech",
"de": "German", "de": "German",
"es": "Spanish", "es": "Spanish",
"fa": "Persian (Farsi)", "fa": "Persian (Farsi)",
"fi": "Finnish",
"fr": "French", "fr": "French",
"it": "Italian", "it": "Italian",
"ja": "Japanese", "ja": "Japanese",
"ko": "Korean", "ko": "Korean",
"lv": "Latvian",
"mi": "Māori", "mi": "Māori",
"nl": "Dutch", "nl": "Dutch",
"pl": "Polish", "pl": "Polish",
"pt": "Portuguese", "pt": "Portuguese",
"pt_BR": "Brazilian Portuguese", "pt_BR": "Brazilian Portuguese",
"ro": "Romanian",
"ru": "Russian", "ru": "Russian",
"sk": "Slovak", "sk": "Slovak",
"sl": "Slovenian", "sl": "Slovenian",
"sr": "Serbian", "sr": "Serbian",
"sr_Latn": "Serbian (Latin script)",
"th": "Thai",
"tr": "Turkish", "tr": "Turkish",
"uk": "Ukrainian", "uk": "Ukrainian",
"zh": "Chinese (Simplified)", "zh": "Chinese (Simplified)",
@@ -352,97 +346,6 @@ def translate_batch(
return parse_response(result.stdout.strip(), len(batch)) return parse_response(result.stdout.strip(), len(batch))
def _translate_single_plaintext(
model: str,
target_lang: str,
item: dict[str, Any],
index: dict[str, Any],
) -> str | None:
"""Translate a single entry with a plain-text prompt (no JSON envelope).
Fallback for an entry whose JSON batch response cannot be parsed — typically
because the source string contains literal double-quotes that the model
echoes back unescaped, corrupting the surrounding JSON. Asking for a bare
string sidesteps the JSON contract entirely. Returns the translation text,
or None if the CLI call fails.
"""
claude_bin = shutil.which("claude")
if not claude_bin:
raise RuntimeError(
"claude CLI not found. Install Claude Code or add it to PATH."
)
lines = [
"You are a professional translator specializing in software UI strings.",
f"Translate the following English string into {_lang_name(target_lang)} "
f"({target_lang}).",
"Return ONLY the translation as plain text — no surrounding quotes, no "
"JSON, no markdown fences, no explanation.",
"Preserve all format placeholders exactly (%(name)s, {name}, %s, %d), any "
"HTML tags, and any inner quotation marks.",
"",
f"English: {item['msgid']}",
]
if item.get("msgid_plural"):
lines.append(f"English plural: {item['msgid_plural']}")
refs = index.get(item["index_key"], {})
ref_lines = [
f"{_lang_name(lang)}: {val}"
for lang, val in sorted(refs.items())
if lang != target_lang and isinstance(val, str) and val
]
if ref_lines:
lines.append("")
lines.append("Reference translations in other languages:")
lines.extend(ref_lines)
prompt = "\n".join(lines)
# claude_bin is resolved via shutil.which — not user-controlled input
result = subprocess.run( # noqa: S603
[claude_bin, "--model", model, "-p"],
input=prompt,
capture_output=True,
text=True,
check=False,
)
if result.returncode != 0:
return None
text = result.stdout.strip()
# Strip accidental markdown fences or wrapping quotes the model may add.
text = re.sub(r"^```[^\n]*\n?", "", text)
text = re.sub(r"\n?```$", "", text).strip()
if len(text) >= 2 and text[0] == '"' and text[-1] == '"':
text = text[1:-1]
return text or None
def _resilient_translate(
model: str,
target_lang: str,
batch: list[dict[str, Any]],
index: dict[str, Any],
) -> dict[int, str]:
"""Translate a batch, isolating entries that break the JSON response contract.
``translate_batch`` sends the whole batch in one request and parses a single
JSON object back. A source string containing literal double-quotes can make
the model emit unescaped quotes, so ``json.loads`` fails and the ENTIRE batch
would be lost. To salvage the rest, on a parse failure (ValueError) we bisect
the batch and recurse; a lone entry that still fails falls back to a
plain-text prompt via ``_translate_single_plaintext``. Returned keys are
positions within ``batch``. RuntimeError (CLI failure) is left to propagate
to the caller, preserving the existing per-batch failure handling.
"""
try:
return translate_batch(model, target_lang, batch, index)
except ValueError:
if len(batch) == 1:
text = _translate_single_plaintext(model, target_lang, batch[0], index)
return {0: text} if text else {}
mid = len(batch) // 2
left = _resilient_translate(model, target_lang, batch[:mid], index)
right = _resilient_translate(model, target_lang, batch[mid:], index)
return {**left, **{k + mid: v for k, v in right.items()}}
def _apply_plural_translation(entry: polib.POEntry, translation: str) -> None: def _apply_plural_translation(entry: polib.POEntry, translation: str) -> None:
"""Distribute a model response across the entry's plural forms. """Distribute a model response across the entry's plural forms.
@@ -559,7 +462,7 @@ def _process_batches(
file=sys.stderr, file=sys.stderr,
) )
try: try:
translations = _resilient_translate(model, lang, batch_items, index) translations = translate_batch(model, lang, batch_items, index)
except (ValueError, RuntimeError) as exc: except (ValueError, RuntimeError) as exc:
print(f" ERROR in batch starting at {batch_start}: {exc}", file=sys.stderr) print(f" ERROR in batch starting at {batch_start}: {exc}", file=sys.stderr)
failed_count += len(batch_entries) failed_count += len(batch_entries)

View File

@@ -86,19 +86,7 @@ def build_index(translations_dir: Path) -> dict[str, Any]:
for lang in langs: for lang in langs:
po_path = translations_dir / lang / "LC_MESSAGES" / "messages.po" po_path = translations_dir / lang / "LC_MESSAGES" / "messages.po"
try: cat = polib.pofile(str(po_path))
cat = polib.pofile(str(po_path))
except (OSError, UnicodeDecodeError) as exc:
# A single malformed catalog shouldn't block backfilling every
# other language. polib raises OSError on syntax errors (e.g. an
# unescaped quote) and UnicodeDecodeError on bad encoding; skip
# either with a loud warning so the corrupt file gets fixed
# separately.
print(
f"WARNING: skipping {lang} — could not parse {po_path}: {exc}",
file=sys.stderr,
)
continue
for entry in cat: for entry in cat:
if not entry.msgid: if not entry.msgid:
continue # skip header entry continue # skip header entry

View File

@@ -20,31 +20,21 @@ Check that source-code changes don't cause translation regressions.
What counts as a regression What counts as a regression
--------------------------- ---------------------------
A regression is an *existing translation that a source change invalidated*: A regression is an *existing translation that a source change invalidated*.
a message that was a **confirmed, non-fuzzy translation** in the baseline and The check keys on the **increase in fuzzy entries** rather than a drop in the
is **fuzzy** after the PR. The check keys on this per-``msgid`` transition translated count, because a count drop happens identically for a benign
rather than on the aggregate count of fuzzy entries, because a bare count *deletion* and a real *rename*, so it cannot distinguish the two — whereas a
cannot tell apart two changes that move the fuzzy total by the same amount: ``#, fuzzy`` marker unambiguously flags a stranded translation.
* ``translated -> fuzzy`` — a reworded source string stranded a real
translation. **This is the regression.**
* ``untranslated -> fuzzy`` — an empty ``msgstr`` was filled with a fuzzy
(unconfirmed) guess, e.g. an AI backfill committed as ``#, fuzzy``. No
existing translation was lost, so this is **not** a regression and must
pass.
Keying on the per-entry transition lets a backfill PR commit fuzzy guesses for
previously-untranslated strings (the ja/fi catalog backfills) without tripping
the check, while still catching a genuine invalidation even when the same PR
also adds new strings (which a count-delta heuristic would let mask it).
Note ``babel_update.sh`` runs ``pybabel update`` with ``--no-fuzzy-matching``, Note ``babel_update.sh`` runs ``pybabel update`` with ``--no-fuzzy-matching``,
so *adding* (or renaming) a source string does **not** auto-generate a fuzzy so *adding* (or renaming) a source string does **not** auto-generate a fuzzy
guess against an unrelated existing translation — new strings land as cleanly guess against an unrelated existing translation — new strings land as cleanly
untranslated (empty ``msgstr``). The fuzzies this check sees therefore arrive untranslated (empty ``msgstr``). This deliberately avoids the prior behaviour
another way — typically a committed ``.po`` edit. *Deleting* a string is still where *every* PR that merely added a translatable string tripped this check on
not a regression: with ``--ignore-obsolete`` it is simply dropped and no fuzzy spurious fuzzies. As a result the check now guards against ``#, fuzzy`` entries
is created. that arrive another way — e.g. a committed ``.po`` edit — rather than ones the
update step synthesises. *Deleting* a string is still not a regression: with
``--ignore-obsolete`` it is simply dropped and no fuzzy is created.
Usage Usage
----- -----
@@ -137,72 +127,28 @@ def count_stats(po_file: Path) -> dict[str, int]:
} }
def entry_keys(po_file: Path) -> dict[str, list[str]]:
"""Return per-``msgid`` key sets for a .po file.
``translated_keys`` lists the non-fuzzy, non-obsolete entries with a
populated ``msgstr`` — confirmed translations a source reword could strand.
``fuzzy_keys`` lists the non-obsolete entries carrying the ``fuzzy`` flag
(however they arrived — a committed backfill guess or a real invalidation).
A key combines ``msgctxt`` and ``msgid`` (gettext's own identity rule) so
context-disambiguated entries stay distinct. The header entry (empty
``msgid``) is ignored. The regression check compares the baseline's
``translated_keys`` against the PR's ``fuzzy_keys``: their intersection is
exactly the set of confirmed translations the PR turned fuzzy.
Raises:
OSError: if ``polib`` cannot read or parse the file. As with a msgfmt
failure, a catalog we cannot parse is surfaced rather than silently
counted as empty.
"""
import polib # type: ignore[import-untyped] # noqa: PLC0415
translated_keys: list[str] = []
fuzzy_keys: list[str] = []
for entry in polib.pofile(str(po_file)):
if entry.obsolete or not entry.msgid:
continue
key = f"{entry.msgctxt}\x04{entry.msgid}" if entry.msgctxt else entry.msgid
if "fuzzy" in entry.flags:
fuzzy_keys.append(key)
elif (
all(entry.msgstr_plural.values())
if entry.msgid_plural
else bool(entry.msgstr)
):
translated_keys.append(key)
return {"translated_keys": translated_keys, "fuzzy_keys": fuzzy_keys}
def get_counts( def get_counts(
translations_dir: Path, translations_dir: Path,
failures: Optional[set[str]] = None, failures: Optional[set[str]] = None,
) -> dict[str, dict[str, object]]: ) -> dict[str, dict[str, int]]:
"""Count translated/fuzzy entries for every ``.po`` file in a directory. """Count translated/fuzzy entries for every ``.po`` file in a directory.
Each language maps to ``{"translated", "fuzzy", "translated_keys",
"fuzzy_keys"}`` — aggregate counts (for the human-readable summary) plus the
per-``msgid`` key sets the regression check actually keys on.
If ``failures`` is provided, the name of each language whose ``.po`` file If ``failures`` is provided, the name of each language whose ``.po`` file
is present on disk but could not be counted (msgfmt non-zero exit, is present on disk but could not be counted (msgfmt non-zero exit, or
unparseable output, or a polib parse error) is added to it. Such a language unparseable output) is added to it. Such a language is deliberately absent
is deliberately absent from the returned mapping — but, unlike a language from the returned mapping — but, unlike a language whose catalog was simply
whose catalog was simply deleted, it must not be mistaken for an intentional deleted, it must not be mistaken for an intentional removal: a caller that
removal: a caller that cares about the distinction (see :func:`cmd_compare`) cares about the distinction (see :func:`cmd_compare`) can inspect
can inspect ``failures`` and treat it as a hard error. ``failures`` and treat it as a hard error.
""" """
counts: dict[str, dict[str, object]] = {} counts: dict[str, dict[str, int]] = {}
for po_file in sorted(translations_dir.glob("*/LC_MESSAGES/messages.po")): for po_file in sorted(translations_dir.glob("*/LC_MESSAGES/messages.po")):
lang = po_file.parent.parent.name lang = po_file.parent.parent.name
if lang in SKIP_LANGS: if lang in SKIP_LANGS:
continue continue
try: try:
stats: dict[str, object] = dict(count_stats(po_file)) counts[lang] = count_stats(po_file)
stats.update(entry_keys(po_file)) except (subprocess.CalledProcessError, RuntimeError) as exc:
counts[lang] = stats
except (subprocess.CalledProcessError, RuntimeError, OSError) as exc:
# A malformed .po file (msgfmt non-zero exit, or stderr we # A malformed .po file (msgfmt non-zero exit, or stderr we
# can't parse) is a real problem worth seeing, but it shouldn't # can't parse) is a real problem worth seeing, but it shouldn't
# take the whole regression check down with it — that would # take the whole regression check down with it — that would
@@ -218,73 +164,42 @@ def get_counts(
return counts return counts
def _normalize(entry: object) -> dict[str, object]: def _normalize(entry: object) -> dict[str, int]:
"""Coerce a baseline entry into ``{"translated", "fuzzy", *_keys}``. """Coerce a baseline entry into ``{"translated", "fuzzy"}``.
``translated_keys``/``fuzzy_keys`` are the per-``msgid`` sets the check Tolerates the legacy baseline format where each language mapped directly to
keys on. They are ``None`` (not ``[]``) when the baseline predates the an integer translated count (no fuzzy data); such entries contribute a
per-entry format — an absent set means "unknown", which routes fuzzy baseline of 0.
:func:`cmd_compare` to the coarse aggregate fallback, whereas an empty list
is a known-empty set. Legacy formats — a ``{"translated", "fuzzy"}`` dict
with no key sets, or a bare integer translated count — are both tolerated.
""" """
if isinstance(entry, dict): if isinstance(entry, dict):
return { return {
"translated": int(entry.get("translated", 0)), "translated": int(entry.get("translated", 0)),
"fuzzy": int(entry.get("fuzzy", 0)), "fuzzy": int(entry.get("fuzzy", 0)),
"translated_keys": (
list(entry["translated_keys"]) if "translated_keys" in entry else None
),
"fuzzy_keys": (
list(entry["fuzzy_keys"]) if "fuzzy_keys" in entry else None
),
} }
if isinstance(entry, int): if isinstance(entry, int):
return { return {"translated": entry, "fuzzy": 0}
"translated": entry,
"fuzzy": 0,
"translated_keys": None,
"fuzzy_keys": None,
}
raise TypeError(f"Unsupported baseline entry: {entry!r}") raise TypeError(f"Unsupported baseline entry: {entry!r}")
def _key_list(stats: dict[str, object], field: str) -> Optional[list[str]]: def build_regression_report(regressions: list[tuple[str, int, int]]) -> str:
"""Return ``stats[field]`` as a list of keys, or ``None`` if unavailable.
A missing or non-list value reads as "unknown" so the caller can fall back
to the aggregate comparison instead of treating it as an empty key set.
"""
value = stats.get(field)
return list(value) if isinstance(value, list) else None
def _count(stats: dict[str, object], field: str) -> int:
"""Return ``stats[field]`` as an int count, defaulting to 0."""
value = stats.get(field, 0)
return value if isinstance(value, int) else 0
def build_regression_report(regressions: list[tuple[str, int, int, int]]) -> str:
"""Build a markdown report for posting as a PR comment. """Build a markdown report for posting as a PR comment.
Each regression tuple is ``(lang, before_fuzzy, after_fuzzy, invalidated)`` Each regression tuple is ``(lang, before_fuzzy, after_fuzzy)``.
where ``invalidated`` is the number of confirmed translations the PR turned
fuzzy.
""" """
rows = "\n".join(f"| `{lang}` | {n} |" for lang, _b, _a, n in regressions) rows = "\n".join(
affected = ", ".join(f"`{lang}`" for lang, *_ in regressions) f"| `{lang}` | {b} | {a} | +{a - b} |" for lang, b, a in regressions
)
affected = ", ".join(f"`{lang}`" for lang, _, _ in regressions)
return ( return (
"## ⚠️ Translation Regression Detected\n\n" "## ⚠️ Translation Regression Detected\n\n"
f"A source change in this PR renamed or reworded strings, invalidating " f"A source change in this PR renamed or reworded strings, invalidating "
f"existing translations (they are now `#, fuzzy`) in {affected}. Please " f"existing translations (they are now `#, fuzzy`) in {affected}. Please "
f"resolve the affected `.po` files before merging.\n\n" f"resolve the affected `.po` files before merging.\n\n"
"_Note: neither intentionally **deleting** a translatable string nor " "_Note: intentionally **deleting** a translatable string is not a "
"filling a previously-**untranslated** entry with a fuzzy guess (e.g. an " "regression and is not flagged here — only translations invalidated by "
"AI backfill) is a regression — only a confirmed translation that a " "a renamed/reworded source string are._\n\n"
"renamed/reworded source string turned fuzzy is flagged here._\n\n" "| Language | Fuzzy before | Fuzzy after | New |\n"
"| Language | Invalidated translations |\n" "|----------|-------------:|------------:|----:|\n"
"|----------|-------------------------:|\n"
f"{rows}\n\n" f"{rows}\n\n"
"### How to fix\n\n" "### How to fix\n\n"
"**1. Install dependencies** (if not already set up):\n\n" "**1. Install dependencies** (if not already set up):\n\n"
@@ -316,41 +231,6 @@ def cmd_count(translations_dir: Path) -> None:
print(json.dumps(counts, indent=2)) print(json.dumps(counts, indent=2))
def _detect_regressions(
before: dict[str, dict[str, object]],
after: dict[str, dict[str, object]],
) -> list[tuple[str, int, int, int]]:
"""Return ``(lang, before_fuzzy, after_fuzzy, invalidated)`` per regressed lang.
A regression is a key in the baseline's ``translated_keys`` that is fuzzy
after the PR — a confirmed translation a source reword stranded. Filling a
previously-untranslated entry with a fuzzy guess (backfill) is therefore not
flagged (its key was absent from the baseline's translated set), and neither
is deleting a string (with ``--ignore-obsolete`` it drops, creating no
fuzzy). When per-entry key data is unavailable (a legacy baseline, or a
catalog whose key set could not be read), fall back to the coarse rule: any
net increase in the aggregate fuzzy count.
"""
regressions: list[tuple[str, int, int, int]] = []
for lang, before_stats in sorted(before.items()):
after_stats = after.get(lang)
if after_stats is None:
# Catalog absent from `after`: an intentional deletion (a
# present-but-uncountable catalog was already caught by the caller).
continue
b_fuzzy = _count(before_stats, "fuzzy")
a_fuzzy = _count(after_stats, "fuzzy")
before_translated = before_stats.get("translated_keys")
after_fuzzy = _key_list(after_stats, "fuzzy_keys")
if isinstance(before_translated, list) and after_fuzzy is not None:
invalidated = set(after_fuzzy) & set(before_translated)
if invalidated:
regressions.append((lang, b_fuzzy, a_fuzzy, len(invalidated)))
elif a_fuzzy > b_fuzzy:
regressions.append((lang, b_fuzzy, a_fuzzy, a_fuzzy - b_fuzzy))
return regressions
def cmd_compare( def cmd_compare(
before_path: str, before_path: str,
translations_dir: Path, translations_dir: Path,
@@ -379,12 +259,23 @@ def cmd_compare(
) )
sys.exit(1) sys.exit(1)
if regressions := _detect_regressions(before, after): # A regression is an *increase* in fuzzy entries: the PR's source diff
# renamed/reworded strings, leaving their committed translations stranded.
# A plain drop in the translated count is NOT used — deleting a string
# lowers it identically to a rename but is a legitimate change, and with
# `pybabel update --ignore-obsolete` a deletion creates no fuzzy entry.
regressions: list[tuple[str, int, int]] = []
for lang, before_stats in sorted(before.items()):
after_stats = after.get(lang, {"translated": 0, "fuzzy": 0})
if after_stats["fuzzy"] > before_stats["fuzzy"]:
regressions.append((lang, before_stats["fuzzy"], after_stats["fuzzy"]))
if regressions:
print("Translation regression detected!\n") print("Translation regression detected!\n")
for lang, _b, _a, n in regressions: for lang, b, a in regressions:
print( print(
f" {lang}: {n} confirmed translation(s) invalidated " f" {lang}: {a - b} translation(s) invalidated "
f"(now fuzzy) by a renamed/reworded source string" f"(fuzzy {b} -> {a}) by a renamed/reworded source string"
) )
print( print(
"\nResolve the newly-fuzzy entries in the affected .po files " "\nResolve the newly-fuzzy entries in the affected .po files "
@@ -399,16 +290,14 @@ def cmd_compare(
# All good — print a summary so it's easy to read in CI logs. # All good — print a summary so it's easy to read in CI logs.
print("No translation regressions.\n") print("No translation regressions.\n")
for lang in sorted(after): for lang in sorted(after):
before_stats: dict[str, object] = before.get(lang, {}) before_stats = before.get(lang, {"translated": 0, "fuzzy": 0})
after_stats = after[lang] after_stats = after[lang]
b_translated = _count(before_stats, "translated") t_delta = after_stats["translated"] - before_stats["translated"]
a_translated = _count(after_stats, "translated") f_delta = after_stats["fuzzy"] - before_stats["fuzzy"]
b_fuzzy = _count(before_stats, "fuzzy")
a_fuzzy = _count(after_stats, "fuzzy")
print( print(
f" {lang}: translated {b_translated} -> {a_translated} " f" {lang}: translated {before_stats['translated']} -> "
f"({a_translated - b_translated:+d}), fuzzy " f"{after_stats['translated']} ({t_delta:+d}), fuzzy "
f"{b_fuzzy} -> {a_fuzzy} ({a_fuzzy - b_fuzzy:+d})" f"{before_stats['fuzzy']} -> {after_stats['fuzzy']} ({f_delta:+d})"
) )

View File

@@ -1 +0,0 @@
../superset-frontend/.nvmrc

View File

@@ -0,0 +1 @@
v24.16.0

View File

@@ -32,7 +32,6 @@ and therefore are not easily unit-testable. We have instead opted to test the sd
This way, the tests can assert that the sdk actually mounts the iframe and communicates with it correctly. This way, the tests can assert that the sdk actually mounts the iframe and communicates with it correctly.
At time of writing, these tests are not written yet, because we haven't yet put together the demo app that they will leverage. At time of writing, these tests are not written yet, because we haven't yet put together the demo app that they will leverage.
### Things to e2e test once we have a demo app: ### Things to e2e test once we have a demo app:
**happy path:** **happy path:**

View File

@@ -41,12 +41,12 @@ npm install --save @superset-ui/embedded-sdk
``` ```
```js ```js
import { embedDashboard } from "@superset-ui/embedded-sdk"; import { embedDashboard } from '@superset-ui/embedded-sdk';
embedDashboard({ embedDashboard({
id: "abc123", // given by the Superset embedding UI id: 'abc123', // given by the Superset embedding UI
supersetDomain: "https://superset.example.com", supersetDomain: 'https://superset.example.com',
mountPoint: document.getElementById("my-superset-container"), // any html element that can contain an iframe mountPoint: document.getElementById('my-superset-container'), // any html element that can contain an iframe
fetchGuestToken: () => fetchGuestTokenFromBackend(), fetchGuestToken: () => fetchGuestTokenFromBackend(),
dashboardUiConfig: { dashboardUiConfig: {
// dashboard UI config: hideTitle, hideTab, hideChartControls, filters.visible, filters.expanded (optional), urlParams (optional) // dashboard UI config: hideTitle, hideTab, hideChartControls, filters.visible, filters.expanded (optional), urlParams (optional)
@@ -55,21 +55,21 @@ embedDashboard({
expanded: true, expanded: true,
}, },
urlParams: { urlParams: {
foo: "value1", foo: 'value1',
bar: "value2", bar: 'value2',
// themeMode: 'dark', // set the initial theme: 'dark' | 'system' | 'default' (default: 'default') // themeMode: 'dark', // set the initial theme: 'dark' | 'system' | 'default' (default: 'default')
// ... // ...
}, },
}, },
// optional additional iframe sandbox attributes // optional additional iframe sandbox attributes
iframeSandboxExtras: [ iframeSandboxExtras: [
"allow-top-navigation", 'allow-top-navigation',
"allow-popups-to-escape-sandbox", 'allow-popups-to-escape-sandbox',
], ],
// optional Permissions Policy features // optional Permissions Policy features
iframeAllowExtras: ["clipboard-write", "fullscreen"], iframeAllowExtras: ['clipboard-write', 'fullscreen'],
// optional config to enforce a particular referrerPolicy // optional config to enforce a particular referrerPolicy
referrerPolicy: "same-origin", referrerPolicy: 'same-origin',
// optional callback to customize permalink URLs // optional callback to customize permalink URLs
resolvePermalinkUrl: ({ key }) => `https://my-app.com/analytics/share/${key}`, resolvePermalinkUrl: ({ key }) => `https://my-app.com/analytics/share/${key}`,
}); });
@@ -163,13 +163,13 @@ Use the `themeMode` URL parameter to control the embedded dashboard's initial co
```js ```js
embedDashboard({ embedDashboard({
id: "abc123", id: 'abc123',
supersetDomain: "https://superset.example.com", supersetDomain: 'https://superset.example.com',
mountPoint: document.getElementById("my-superset-container"), mountPoint: document.getElementById('my-superset-container'),
fetchGuestToken: () => fetchGuestTokenFromBackend(), fetchGuestToken: () => fetchGuestTokenFromBackend(),
dashboardUiConfig: { dashboardUiConfig: {
urlParams: { urlParams: {
themeMode: "dark", // 'dark' | 'system' | 'default' (default: 'default') themeMode: 'dark', // 'dark' | 'system' | 'default' (default: 'default')
}, },
}, },
}); });
@@ -193,7 +193,7 @@ To pass additional sandbox attributes you can use `iframeSandboxExtras`:
```js ```js
// optional additional iframe sandbox attributes // optional additional iframe sandbox attributes
iframeSandboxExtras: ["allow-top-navigation", "allow-popups-to-escape-sandbox"]; iframeSandboxExtras: ['allow-top-navigation', 'allow-popups-to-escape-sandbox'];
``` ```
### Permissions Policy ### Permissions Policy
@@ -202,7 +202,7 @@ To enable specific browser features within the embedded iframe, use `iframeAllow
```js ```js
// optional Permissions Policy features // optional Permissions Policy features
iframeAllowExtras: ["clipboard-write", "fullscreen"]; iframeAllowExtras: ['clipboard-write', 'fullscreen'];
``` ```
Common permissions you might need: Common permissions you might need:
@@ -225,9 +225,9 @@ When users click share buttons inside an embedded dashboard, Superset generates
```js ```js
embedDashboard({ embedDashboard({
id: "abc123", id: 'abc123',
supersetDomain: "https://superset.example.com", supersetDomain: 'https://superset.example.com',
mountPoint: document.getElementById("my-superset-container"), mountPoint: document.getElementById('my-superset-container'),
fetchGuestToken: () => fetchGuestTokenFromBackend(), fetchGuestToken: () => fetchGuestTokenFromBackend(),
// Customize permalink URLs // Customize permalink URLs
@@ -245,9 +245,9 @@ To restore the dashboard state from a permalink in your app:
const permalinkKey = routeParams.key; const permalinkKey = routeParams.key;
embedDashboard({ embedDashboard({
id: "abc123", id: 'abc123',
supersetDomain: "https://superset.example.com", supersetDomain: 'https://superset.example.com',
mountPoint: document.getElementById("my-superset-container"), mountPoint: document.getElementById('my-superset-container'),
fetchGuestToken: () => fetchGuestTokenFromBackend(), fetchGuestToken: () => fetchGuestTokenFromBackend(),
resolvePermalinkUrl: ({ key }) => `https://my-app.com/analytics/share/${key}`, resolvePermalinkUrl: ({ key }) => `https://my-app.com/analytics/share/${key}`,
dashboardUiConfig: { dashboardUiConfig: {

View File

@@ -18,7 +18,9 @@
*/ */
module.exports = { module.exports = {
presets: ["@babel/preset-typescript", "@babel/preset-env"], presets: [
"@babel/preset-typescript",
"@babel/preset-env"
],
sourceMaps: true, sourceMaps: true,
ignore: ["**/*.test.ts"],
}; };

File diff suppressed because it is too large Load Diff

View File

@@ -22,9 +22,9 @@
"module": "lib/index.js", "module": "lib/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
"scripts": { "scripts": {
"build": "tsc && babel src --out-dir lib --extensions '.ts' && webpack --mode production", "build": "tsc && babel src --out-dir lib --extensions '.ts,.tsx' && webpack --mode production",
"ci:release": "node ./release-if-necessary.js", "ci:release": "node ./release-if-necessary.js",
"test": "vitest --run --dir src" "test": "jest"
}, },
"browserslist": [ "browserslist": [
"last 3 chrome versions", "last 3 chrome versions",
@@ -41,11 +41,12 @@
"@babel/core": "^7.25.2", "@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.4", "@babel/preset-env": "^7.25.4",
"@babel/preset-typescript": "^7.24.7", "@babel/preset-typescript": "^7.24.7",
"@types/node": "^25.4.0", "@types/jest": "^29.5.12",
"@types/node": "^22.5.4",
"babel-loader": "^9.1.3", "babel-loader": "^9.1.3",
"jest": "^29.7.0",
"tscw-config": "^1.1.2", "tscw-config": "^1.1.2",
"typescript": "^5.9.3", "typescript": "^5.6.2",
"vitest": "^4.0.18",
"webpack": "^5.94.0", "webpack": "^5.94.0",
"webpack-cli": "^5.1.4" "webpack-cli": "^5.1.4"
}, },

View File

@@ -17,15 +17,15 @@
* under the License. * under the License.
*/ */
const { execSync } = require("child_process"); const { execSync } = require('child_process');
const { name, version } = require("./package.json"); const { name, version } = require('./package.json');
function log(...args) { function log(...args) {
console.log("[embedded-sdk-release]", ...args); console.log('[embedded-sdk-release]', ...args);
} }
function logError(...args) { function logError(...args) {
console.error("[embedded-sdk-release]", ...args); console.error('[embedded-sdk-release]', ...args);
} }
(async () => { (async () => {
@@ -38,13 +38,13 @@ function logError(...args) {
const { status } = await fetch(packageUrl); const { status } = await fetch(packageUrl);
if (status === 200) { if (status === 200) {
log("version already exists on npm, exiting"); log('version already exists on npm, exiting');
} else if (status === 404) { } else if (status === 404) {
log("release required, building"); log('release required, building');
try { try {
execSync("npm run build", { stdio: "pipe" }); execSync('npm run build', { stdio: 'pipe' });
log("build successful, publishing"); log('build successful, publishing')
execSync("npm publish --access public", { stdio: "pipe" }); execSync('npm publish --access public', { stdio: 'pipe' });
log(`published ${version} to npm`); log(`published ${version} to npm`);
} catch (err) { } catch (err) {
// npm writes failure details to stderr (auth/permission/registry // npm writes failure details to stderr (auth/permission/registry
@@ -52,7 +52,7 @@ function logError(...args) {
// the real cause in CI logs. // the real cause in CI logs.
if (err.stdout) console.error(String(err.stdout)); if (err.stdout) console.error(String(err.stdout));
if (err.stderr) console.error(String(err.stderr)); if (err.stderr) console.error(String(err.stderr));
logError("Encountered an error, details should be above"); logError('Encountered an error, details should be above');
process.exitCode = 1; process.exitCode = 1;
} }
} else { } else {

View File

@@ -18,9 +18,7 @@
*/ */
export const IFRAME_COMMS_MESSAGE_TYPE = "__embedded_comms__"; export const IFRAME_COMMS_MESSAGE_TYPE = "__embedded_comms__";
export const DASHBOARD_UI_FILTER_CONFIG_URL_PARAM_KEY: { export const DASHBOARD_UI_FILTER_CONFIG_URL_PARAM_KEY: { [index: string]: any } = {
[index: string]: any;
} = {
visible: "show_filters", visible: "show_filters",
expanded: "expand_filters", expanded: "expand_filters",
}; }

View File

@@ -24,23 +24,22 @@ import {
DEFAULT_TOKEN_EXP_MS, DEFAULT_TOKEN_EXP_MS,
DEFAULT_TOKEN_REFRESH_RETRY_MS, DEFAULT_TOKEN_REFRESH_RETRY_MS,
} from "./guestTokenRefresh"; } from "./guestTokenRefresh";
import { afterAll, beforeAll, it, expect, describe, vi } from "vitest";
describe("guest token refresh", () => { describe("guest token refresh", () => {
beforeAll(() => { beforeAll(() => {
vi.useFakeTimers(); jest.useFakeTimers();
vi.setSystemTime(new Date("2022-03-03 01:00")); jest.setSystemTime(new Date("2022-03-03 01:00"));
vi.spyOn(globalThis, "setTimeout"); jest.spyOn(global, "setTimeout");
}); });
afterAll(() => { afterAll(() => {
vi.useRealTimers(); jest.useRealTimers();
}); });
function makeFakeJWT(claims: any) { function makeFakeJWT(claims: any) {
// not a valid jwt, but close enough for this code // not a valid jwt, but close enough for this code
const tokenifiedClaims = Buffer.from(JSON.stringify(claims)).toString( const tokenifiedClaims = Buffer.from(JSON.stringify(claims)).toString(
"base64", "base64"
); );
return `abc.${tokenifiedClaims}.xyz`; return `abc.${tokenifiedClaims}.xyz`;
} }

View File

@@ -18,23 +18,17 @@
*/ */
import { jwtDecode } from "jwt-decode"; import { jwtDecode } from "jwt-decode";
export const REFRESH_TIMING_BUFFER_MS = 5000; // refresh guest token early to avoid failed superset requests export const REFRESH_TIMING_BUFFER_MS = 5000 // refresh guest token early to avoid failed superset requests
export const MIN_REFRESH_WAIT_MS = 10000; // avoid blasting requests as fast as the cpu can handle export const MIN_REFRESH_WAIT_MS = 10000 // avoid blasting requests as fast as the cpu can handle
export const DEFAULT_TOKEN_EXP_MS = 300000; // (5 min) used only when parsing guest token exp fails export const DEFAULT_TOKEN_EXP_MS = 300000 // (5 min) used only when parsing guest token exp fails
export const DEFAULT_TOKEN_REFRESH_RETRY_MS = 10000; // wait before retrying a failed/timed-out token refresh export const DEFAULT_TOKEN_REFRESH_RETRY_MS = 10000 // wait before retrying a failed/timed-out token refresh
// when do we refresh the guest token? // when do we refresh the guest token?
export function getGuestTokenRefreshTiming(currentGuestToken: string) { export function getGuestTokenRefreshTiming(currentGuestToken: string) {
const parsedJwt = jwtDecode<Record<string, any>>(currentGuestToken); const parsedJwt = jwtDecode<Record<string, any>>(currentGuestToken);
// if exp is int, it is in seconds, but Date() takes milliseconds // if exp is int, it is in seconds, but Date() takes milliseconds
const exp = new Date( const exp = new Date(/[^0-9\.]/g.test(parsedJwt.exp) ? parsedJwt.exp : parseFloat(parsedJwt.exp) * 1000);
/[^0-9\.]/g.test(parsedJwt.exp) const isValidDate = exp.toString() !== 'Invalid Date';
? parsedJwt.exp const ttl = isValidDate ? Math.max(MIN_REFRESH_WAIT_MS, exp.getTime() - Date.now()) : DEFAULT_TOKEN_EXP_MS;
: parseFloat(parsedJwt.exp) * 1000,
);
const isValidDate = exp.toString() !== "Invalid Date";
const ttl = isValidDate
? Math.max(MIN_REFRESH_WAIT_MS, exp.getTime() - Date.now())
: DEFAULT_TOKEN_EXP_MS;
return ttl - REFRESH_TIMING_BUFFER_MS; return ttl - REFRESH_TIMING_BUFFER_MS;
} }

View File

@@ -20,15 +20,15 @@
import { import {
DASHBOARD_UI_FILTER_CONFIG_URL_PARAM_KEY, DASHBOARD_UI_FILTER_CONFIG_URL_PARAM_KEY,
IFRAME_COMMS_MESSAGE_TYPE, IFRAME_COMMS_MESSAGE_TYPE,
} from "./const"; } from './const';
// We can swap this out for the actual switchboard package once it gets published // We can swap this out for the actual switchboard package once it gets published
import { Switchboard } from "@superset-ui/switchboard"; import { Switchboard } from '@superset-ui/switchboard';
import { import {
getGuestTokenRefreshTiming, getGuestTokenRefreshTiming,
DEFAULT_TOKEN_REFRESH_RETRY_MS, DEFAULT_TOKEN_REFRESH_RETRY_MS,
} from "./guestTokenRefresh"; } from './guestTokenRefresh';
import { withTimeout } from "./withTimeout"; import { withTimeout } from './withTimeout';
/** /**
* The function to fetch a guest token from your Host App's backend server. * The function to fetch a guest token from your Host App's backend server.
@@ -97,7 +97,7 @@ export type ObserveDataMaskCallbackFn = (
nativeFiltersChanged: boolean; nativeFiltersChanged: boolean;
}, },
) => void; ) => void;
export type ThemeMode = "default" | "dark" | "system"; export type ThemeMode = 'default' | 'dark' | 'system';
/** /**
* Callback to resolve permalink URLs. * Callback to resolve permalink URLs.
@@ -113,12 +113,12 @@ export type EmbeddedDashboard = {
unmount: () => void; unmount: () => void;
getDashboardPermalink: (anchor: string) => Promise<string>; getDashboardPermalink: (anchor: string) => Promise<string>;
getActiveTabs: () => Promise<string[]>; getActiveTabs: () => Promise<string[]>;
observeDataMask: (callbackFn: ObserveDataMaskCallbackFn) => void; observeDataMask: (
callbackFn: ObserveDataMaskCallbackFn,
) => void;
getDataMask: () => Promise<Record<string, any>>; getDataMask: () => Promise<Record<string, any>>;
getChartStates: () => Promise<Record<string, any>>; getChartStates: () => Promise<Record<string, any>>;
getChartDataPayloads: (params?: { getChartDataPayloads: (params?: { chartId?: number }) => Promise<Record<string, any>>;
chartId?: number;
}) => Promise<Record<string, any>>;
setThemeConfig: (themeConfig: Record<string, any>) => void; setThemeConfig: (themeConfig: Record<string, any>) => void;
setThemeMode: (mode: ThemeMode) => void; setThemeMode: (mode: ThemeMode) => void;
}; };
@@ -133,7 +133,7 @@ export async function embedDashboard({
fetchGuestToken, fetchGuestToken,
dashboardUiConfig, dashboardUiConfig,
debug = false, debug = false,
iframeTitle = "Embedded Dashboard", iframeTitle = 'Embedded Dashboard',
iframeSandboxExtras = [], iframeSandboxExtras = [],
iframeAllowExtras = [], iframeAllowExtras = [],
referrerPolicy, referrerPolicy,
@@ -152,13 +152,13 @@ export async function embedDashboard({
return withTimeout( return withTimeout(
fetchGuestToken(), fetchGuestToken(),
guestTokenFetchTimeoutMs, guestTokenFetchTimeoutMs,
"fetchGuestToken", 'fetchGuestToken',
); );
} }
log("embedding"); log('embedding');
if (supersetDomain.endsWith("/")) { if (supersetDomain.endsWith('/')) {
supersetDomain = supersetDomain.slice(0, -1); supersetDomain = supersetDomain.slice(0, -1);
} }
@@ -185,15 +185,15 @@ export async function embedDashboard({
} }
async function mountIframe(): Promise<Switchboard> { async function mountIframe(): Promise<Switchboard> {
return new Promise((resolve) => { return new Promise(resolve => {
const iframe = document.createElement("iframe"); const iframe = document.createElement('iframe');
const dashboardConfigUrlParams = dashboardUiConfig const dashboardConfigUrlParams = dashboardUiConfig
? { uiConfig: `${calculateConfig()}` } ? { uiConfig: `${calculateConfig()}` }
: undefined; : undefined;
const filterConfig = dashboardUiConfig?.filters || {}; const filterConfig = dashboardUiConfig?.filters || {};
const filterConfigKeys = Object.keys(filterConfig); const filterConfigKeys = Object.keys(filterConfig);
const filterConfigUrlParams = Object.fromEntries( const filterConfigUrlParams = Object.fromEntries(
filterConfigKeys.map((key) => [ filterConfigKeys.map(key => [
DASHBOARD_UI_FILTER_CONFIG_URL_PARAM_KEY[key], DASHBOARD_UI_FILTER_CONFIG_URL_PARAM_KEY[key],
filterConfig[key], filterConfig[key],
]), ]),
@@ -206,16 +206,16 @@ export async function embedDashboard({
...dashboardUiConfig?.urlParams, ...dashboardUiConfig?.urlParams,
}; };
const urlParamsString = Object.keys(urlParams).length const urlParamsString = Object.keys(urlParams).length
? "?" + new URLSearchParams(urlParams).toString() ? '?' + new URLSearchParams(urlParams).toString()
: ""; : '';
// set up the iframe's sandbox configuration // set up the iframe's sandbox configuration
iframe.sandbox.add("allow-same-origin"); // needed for postMessage to work iframe.sandbox.add('allow-same-origin'); // needed for postMessage to work
iframe.sandbox.add("allow-scripts"); // obviously the iframe needs scripts iframe.sandbox.add('allow-scripts'); // obviously the iframe needs scripts
iframe.sandbox.add("allow-presentation"); // for fullscreen charts iframe.sandbox.add('allow-presentation'); // for fullscreen charts
iframe.sandbox.add("allow-downloads"); // for downloading charts as image iframe.sandbox.add('allow-downloads'); // for downloading charts as image
iframe.sandbox.add("allow-forms"); // for forms to submit iframe.sandbox.add('allow-forms'); // for forms to submit
iframe.sandbox.add("allow-popups"); // for exporting charts as csv iframe.sandbox.add('allow-popups'); // for exporting charts as csv
// additional sandbox props // additional sandbox props
iframeSandboxExtras.forEach((key: string) => { iframeSandboxExtras.forEach((key: string) => {
iframe.sandbox.add(key); iframe.sandbox.add(key);
@@ -226,7 +226,7 @@ export async function embedDashboard({
} }
// add the event listener before setting src, to be 100% sure that we capture the load event // add the event listener before setting src, to be 100% sure that we capture the load event
iframe.addEventListener("load", () => { iframe.addEventListener('load', () => {
// MessageChannel allows us to send and receive messages smoothly between our window and the iframe // MessageChannel allows us to send and receive messages smoothly between our window and the iframe
// See https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API // See https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API
const commsChannel = new MessageChannel(); const commsChannel = new MessageChannel();
@@ -237,35 +237,35 @@ export async function embedDashboard({
// See https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage // See https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
// we know the content window isn't null because we are in the load event handler. // we know the content window isn't null because we are in the load event handler.
iframe.contentWindow!.postMessage( iframe.contentWindow!.postMessage(
{ type: IFRAME_COMMS_MESSAGE_TYPE, handshake: "port transfer" }, { type: IFRAME_COMMS_MESSAGE_TYPE, handshake: 'port transfer' },
supersetDomain, supersetDomain,
[theirPort], [theirPort],
); );
log("sent message channel to the iframe"); log('sent message channel to the iframe');
// return our port from the promise // return our port from the promise
resolve( resolve(
new Switchboard({ new Switchboard({
port: ourPort, port: ourPort,
name: "superset-embedded-sdk", name: 'superset-embedded-sdk',
debug, debug,
}), }),
); );
}); });
iframe.src = `${supersetDomain}/embedded/${id}${urlParamsString}`; iframe.src = `${supersetDomain}/embedded/${id}${urlParamsString}`;
iframe.title = iframeTitle; iframe.title = iframeTitle;
iframe.style.background = "transparent"; iframe.style.background = 'transparent';
// Permissions Policy features the embedded dashboard relies on. Modern // Permissions Policy features the embedded dashboard relies on. Modern
// browsers gate these APIs on the iframe's `allow` attribute regardless // browsers gate these APIs on the iframe's `allow` attribute regardless
// of sandbox flags, so we include them by default. Host apps can extend // of sandbox flags, so we include them by default. Host apps can extend
// the list via `iframeAllowExtras`. // the list via `iframeAllowExtras`.
const allowFeatures = Array.from( const allowFeatures = Array.from(
new Set(["fullscreen", "clipboard-write", ...iframeAllowExtras]), new Set(['fullscreen', 'clipboard-write', ...iframeAllowExtras]),
); );
iframe.setAttribute("allow", allowFeatures.join("; ")); iframe.setAttribute('allow', allowFeatures.join('; '));
//@ts-ignore //@ts-ignore
mountPoint.replaceChildren(iframe); mountPoint.replaceChildren(iframe);
log("placed the iframe"); log('placed the iframe');
}); });
} }
@@ -285,8 +285,8 @@ export async function embedDashboard({
throw err; throw err;
} }
ourPort.emit("guestToken", { guestToken }); ourPort.emit('guestToken', { guestToken });
log("sent guest token"); log('sent guest token');
// Track the pending refresh timer so it can be cancelled on unmount, and // Track the pending refresh timer so it can be cancelled on unmount, and
// stop the cycle once unmounted so it cannot leak across mount/unmount cycles. // stop the cycle once unmounted so it cannot leak across mount/unmount cycles.
@@ -298,7 +298,7 @@ export async function embedDashboard({
try { try {
const newGuestToken = await fetchGuestTokenWithTimeout(); const newGuestToken = await fetchGuestTokenWithTimeout();
if (unmounted) return; if (unmounted) return;
ourPort.emit("guestToken", { guestToken: newGuestToken }); ourPort.emit('guestToken', { guestToken: newGuestToken });
refreshTimer = setTimeout( refreshTimer = setTimeout(
refreshGuestToken, refreshGuestToken,
getGuestTokenRefreshTiming(newGuestToken), getGuestTokenRefreshTiming(newGuestToken),
@@ -307,7 +307,7 @@ export async function embedDashboard({
// A transient fetch failure or timeout must not permanently stop the // A transient fetch failure or timeout must not permanently stop the
// refresh cycle. Log it and retry so the session can recover once the // refresh cycle. Log it and retry so the session can recover once the
// host callback succeeds again. // host callback succeeds again.
log("failed to refresh guest token, will retry:", err); log('failed to refresh guest token, will retry:', err);
if (unmounted) return; if (unmounted) return;
refreshTimer = setTimeout( refreshTimer = setTimeout(
refreshGuestToken, refreshGuestToken,
@@ -325,7 +325,7 @@ export async function embedDashboard({
// Returns null if no callback provided or on error, allowing iframe to use default URL // Returns null if no callback provided or on error, allowing iframe to use default URL
ourPort.start(); ourPort.start();
ourPort.defineMethod( ourPort.defineMethod(
"resolvePermalinkUrl", 'resolvePermalinkUrl',
async ({ key }: { key: string }): Promise<string | null> => { async ({ key }: { key: string }): Promise<string | null> => {
if (!resolvePermalinkUrl) { if (!resolvePermalinkUrl) {
return null; return null;
@@ -333,14 +333,14 @@ export async function embedDashboard({
try { try {
return await resolvePermalinkUrl({ key }); return await resolvePermalinkUrl({ key });
} catch (error) { } catch (error) {
log("Error in resolvePermalinkUrl callback:", error); log('Error in resolvePermalinkUrl callback:', error);
return null; return null;
} }
}, },
); );
function unmount() { function unmount() {
log("unmounting"); log('unmounting');
unmounted = true; unmounted = true;
if (refreshTimer !== undefined) { if (refreshTimer !== undefined) {
clearTimeout(refreshTimer); clearTimeout(refreshTimer);
@@ -350,25 +350,24 @@ export async function embedDashboard({
mountPoint.replaceChildren(); mountPoint.replaceChildren();
} }
const getScrollSize = () => ourPort.get<Size>("getScrollSize"); const getScrollSize = () => ourPort.get<Size>('getScrollSize');
const getDashboardPermalink = (anchor: string) => const getDashboardPermalink = (anchor: string) =>
ourPort.get<string>("getDashboardPermalink", { anchor }); ourPort.get<string>('getDashboardPermalink', { anchor });
const getActiveTabs = () => ourPort.get<string[]>("getActiveTabs"); const getActiveTabs = () => ourPort.get<string[]>('getActiveTabs');
const getDataMask = () => ourPort.get<Record<string, any>>("getDataMask"); const getDataMask = () => ourPort.get<Record<string, any>>('getDataMask');
const getChartStates = () => const getChartStates = () => ourPort.get<Record<string, any>>('getChartStates');
ourPort.get<Record<string, any>>("getChartStates");
const getChartDataPayloads = (params?: { chartId?: number }) => const getChartDataPayloads = (params?: { chartId?: number }) =>
ourPort.get<Record<string, any>>("getChartDataPayloads", params); ourPort.get<Record<string, any>>('getChartDataPayloads', params);
const observeDataMask = (callbackFn: ObserveDataMaskCallbackFn) => { const observeDataMask = (
ourPort.defineMethod("observeDataMask", callbackFn); callbackFn: ObserveDataMaskCallbackFn,
) => {
ourPort.defineMethod('observeDataMask', callbackFn);
}; };
// TODO: Add proper types once theming branch is merged // TODO: Add proper types once theming branch is merged
const setThemeConfig = async ( const setThemeConfig = async (themeConfig: Record<string, any>): Promise<void> => {
themeConfig: Record<string, any>,
): Promise<void> => {
try { try {
ourPort.emit("setThemeConfig", { themeConfig }); ourPort.emit('setThemeConfig', { themeConfig });
log("Theme config sent successfully (or at least message dispatched)"); log('Theme config sent successfully (or at least message dispatched)');
} catch (error) { } catch (error) {
log( log(
'Error sending theme config. Ensure the iframe side implements the "setThemeConfig" method.', 'Error sending theme config. Ensure the iframe side implements the "setThemeConfig" method.',
@@ -379,7 +378,7 @@ export async function embedDashboard({
const setThemeMode = (mode: ThemeMode): void => { const setThemeMode = (mode: ThemeMode): void => {
try { try {
ourPort.emit("setThemeMode", { mode }); ourPort.emit('setThemeMode', { mode });
log(`Theme mode set to: ${mode}`); log(`Theme mode set to: ${mode}`);
} catch (error) { } catch (error) {
log( log(

View File

@@ -18,23 +18,22 @@
*/ */
import { withTimeout } from "./withTimeout"; import { withTimeout } from "./withTimeout";
import { test, expect } from "vitest";
test("resolves with the value when the promise settles in time", async () => { test("resolves with the value when the promise settles in time", async () => {
await expect(withTimeout(Promise.resolve("ok"), 1000, "fetch")).resolves.toBe( await expect(withTimeout(Promise.resolve("ok"), 1000, "fetch")).resolves.toBe(
"ok", "ok"
); );
}); });
test("rejects when the promise does not settle within the timeout", async () => { test("rejects when the promise does not settle within the timeout", async () => {
const never = new Promise<string>(() => {}); const never = new Promise<string>(() => {});
await expect(withTimeout(never, 10, "fetch")).rejects.toThrow( await expect(withTimeout(never, 10, "fetch")).rejects.toThrow(
/fetch did not resolve within 10ms/, /fetch did not resolve within 10ms/
); );
}); });
test("passes the promise through unchanged when the timeout is disabled", async () => { test("passes the promise through unchanged when the timeout is disabled", async () => {
await expect(withTimeout(Promise.resolve("ok"), 0, "fetch")).resolves.toBe( await expect(withTimeout(Promise.resolve("ok"), 0, "fetch")).resolves.toBe(
"ok", "ok"
); );
}); });

View File

@@ -3,7 +3,7 @@
// syntax rules // syntax rules
"strict": true, "strict": true,
"moduleResolution": "bundler", "moduleResolution": "node",
// environment // environment
"target": "es6", "target": "es6",
@@ -13,9 +13,7 @@
// output // output
"outDir": "./dist", "outDir": "./dist",
"emitDeclarationOnly": true, "emitDeclarationOnly": true,
"declaration": true, "declaration": true
"types": ["node"]
}, },
"include": [ "include": [
@@ -23,7 +21,7 @@
], ],
"exclude": [ "exclude": [
"src/**/*.test.ts", "tests",
"dist", "dist",
"lib", "lib",
"node_modules" "node_modules"

View File

@@ -17,19 +17,19 @@
* under the License. * under the License.
*/ */
const path = require("path"); const path = require('path');
module.exports = { module.exports = {
entry: "./src/index.ts", entry: './src/index.ts',
output: { output: {
filename: "index.js", filename: 'index.js',
path: path.resolve(__dirname, "bundle"), path: path.resolve(__dirname, 'bundle'),
// this exposes the library's exports under a global variable // this exposes the library's exports under a global variable
library: { library: {
name: "supersetEmbeddedSdk", name: "supersetEmbeddedSdk",
type: "umd", type: "umd"
}, }
}, },
devtool: "source-map", devtool: "source-map",
module: { module: {
@@ -38,12 +38,12 @@ module.exports = {
test: /\.[tj]s$/, test: /\.[tj]s$/,
// babel-loader is faster than ts-loader because it ignores types. // babel-loader is faster than ts-loader because it ignores types.
// We do type checking in a separate process, so that's fine. // We do type checking in a separate process, so that's fine.
use: "babel-loader", use: 'babel-loader',
exclude: /node_modules/, exclude: /node_modules/,
}, },
], ],
}, },
resolve: { resolve: {
extensions: [".ts", ".js"], extensions: ['.ts', '.js'],
}, },
}; };

View File

@@ -44,6 +44,7 @@ module.exports = {
'@babel/preset-typescript', '@babel/preset-typescript',
], ],
plugins: [ plugins: [
'lodash',
'@babel/plugin-syntax-dynamic-import', '@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-export-namespace-from', '@babel/plugin-transform-export-namespace-from',
['@babel/plugin-transform-class-properties', { loose: true }], ['@babel/plugin-transform-class-properties', { loose: true }],

View File

@@ -0,0 +1,118 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { DATABASE_LIST } from 'cypress/utils/urls';
function closeModal() {
cy.get('body').then($body => {
if ($body.find('[data-test="database-modal"]').length) {
cy.get('[aria-label="Close"]').eq(1).click();
}
});
}
describe('Add database', () => {
before(() => {
cy.visit(DATABASE_LIST);
});
beforeEach(() => {
cy.intercept('POST', '**/api/v1/database/validate_parameters/**').as(
'validateParams',
);
cy.intercept('POST', '**/api/v1/database/').as('createDb');
closeModal();
cy.getBySel('btn-create-database').click();
});
it('should open dynamic form', () => {
cy.get('.preferred > :nth-child(1)').click();
cy.get('input[name="host"]').should('have.value', '');
cy.get('input[name="port"]').should('have.value', '');
cy.get('input[name="database"]').should('have.value', '');
cy.get('input[name="username"]').should('have.value', '');
cy.get('input[name="password"]').should('have.value', '');
cy.get('input[name="database_name"]').should('have.value', '');
});
it('should open sqlalchemy form', () => {
cy.get('.preferred > :nth-child(1)').click();
cy.getBySel('sqla-connect-btn').click();
cy.getBySel('database-name-input').should('be.visible');
cy.getBySel('sqlalchemy-uri-input').should('be.visible');
});
it('show error alerts on dynamic form for bad host', () => {
cy.get('.preferred > :nth-child(1)').click();
cy.get('input[name="host"]').type('badhost', { force: true });
cy.get('input[name="port"]').type('5432', { force: true });
cy.get('input[name="username"]').type('testusername', { force: true });
cy.get('input[name="database"]').type('testdb', { force: true });
cy.get('input[name="password"]').type('testpass', { force: true });
cy.get('body').click(0, 0);
cy.wait('@validateParams', { timeout: 30000 });
cy.getBySel('btn-submit-connection').should('not.be.disabled');
cy.getBySel('btn-submit-connection').click({ force: true });
cy.wait('@validateParams', { timeout: 30000 }).then(() => {
cy.wait('@createDb', { timeout: 60000 }).then(() => {
cy.contains(
'.ant-form-item-explain-error',
"The hostname provided can't be resolved",
).should('exist');
});
});
});
it('show error alerts on dynamic form for bad port', () => {
cy.get('.preferred > :nth-child(1)').click();
cy.get('input[name="host"]').type('localhost', { force: true });
cy.get('body').click(0, 0);
cy.wait('@validateParams', { timeout: 30000 });
cy.get('input[name="port"]').type('5430', { force: true });
cy.get('input[name="database"]').type('testdb', { force: true });
cy.get('input[name="username"]').type('testusername', { force: true });
cy.wait('@validateParams', { timeout: 30000 });
cy.get('input[name="password"]').type('testpass', { force: true });
cy.wait('@validateParams');
cy.getBySel('btn-submit-connection').should('not.be.disabled');
cy.getBySel('btn-submit-connection').click({ force: true });
cy.wait('@validateParams', { timeout: 30000 }).then(() => {
cy.get('body').click(0, 0);
cy.getBySel('btn-submit-connection').click({ force: true });
cy.wait('@createDb', { timeout: 60000 }).then(() => {
cy.contains(
'.ant-form-item-explain-error',
'The port is closed',
).should('exist');
});
});
});
});

View File

@@ -19,8 +19,9 @@
export const DASHBOARD_LIST = '/dashboard/list/'; export const DASHBOARD_LIST = '/dashboard/list/';
export const CHART_LIST = '/chart/list/'; export const CHART_LIST = '/chart/list/';
export const WORLD_HEALTH_DASHBOARD = '/dashboard/world_health/'; export const WORLD_HEALTH_DASHBOARD = '/superset/dashboard/world_health/';
export const SAMPLE_DASHBOARD_1 = '/dashboard/1-sample-dashboard/'; export const SAMPLE_DASHBOARD_1 = '/superset/dashboard/1-sample-dashboard/';
export const SUPPORTED_CHARTS_DASHBOARD = '/dashboard/supported_charts_dash/'; export const SUPPORTED_CHARTS_DASHBOARD =
export const TABBED_DASHBOARD = '/dashboard/tabbed_dash/'; '/superset/dashboard/supported_charts_dash/';
export const TABBED_DASHBOARD = '/superset/dashboard/tabbed_dash/';
export const DATABASE_LIST = '/databaseview/list'; export const DATABASE_LIST = '/databaseview/list';

Some files were not shown because too many files have changed in this diff Show More