From bc0c40c80e28280c441ef31fc6e6a60e50dd8e1c Mon Sep 17 00:00:00 2001 From: Tadeh Alexani Date: Tue, 23 Sep 2025 20:46:52 +0200 Subject: [PATCH] feat(helm): Allow multi-database connection support (#34327) --- helm/superset/Chart.yaml | 2 +- helm/superset/README.md | 3 ++- helm/superset/templates/_helpers.tpl | 13 ++++++++++++- helm/superset/values.yaml | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/helm/superset/Chart.yaml b/helm/superset/Chart.yaml index 1c8f2b54755..12389631b7f 100644 --- a/helm/superset/Chart.yaml +++ b/helm/superset/Chart.yaml @@ -29,7 +29,7 @@ maintainers: - name: craig-rueda email: craig@craigrueda.com url: https://github.com/craig-rueda -version: 0.15.0 # See [README](https://github.com/apache/superset/blob/master/helm/superset/README.md#versioning) for version details. +version: 0.15.1 # See [README](https://github.com/apache/superset/blob/master/helm/superset/README.md#versioning) for version details. dependencies: - name: postgresql version: 13.4.4 diff --git a/helm/superset/README.md b/helm/superset/README.md index 22e528db000..5371e88b111 100644 --- a/helm/superset/README.md +++ b/helm/superset/README.md @@ -23,7 +23,7 @@ NOTE: This file is generated by helm-docs: https://github.com/norwoodj/helm-docs # superset -![Version: 0.15.0](https://img.shields.io/badge/Version-0.15.0-informational?style=flat-square) +![Version: 0.15.1](https://img.shields.io/badge/Version-0.15.1-informational?style=flat-square) Apache Superset is a modern, enterprise-ready business intelligence web application @@ -203,6 +203,7 @@ On helm this can be set on `extraSecretEnv.SUPERSET_SECRET_KEY` or `configOverri | supersetNode.connections.db_name | string | `"superset"` | | | supersetNode.connections.db_pass | string | `"superset"` | | | supersetNode.connections.db_port | string | `"5432"` | | +| supersetNode.connections.db_type | string | `"postgresql"` | Database type for Superset metadata (Supported types: "postgresql", "mysql") | | supersetNode.connections.db_user | string | `"superset"` | | | supersetNode.connections.redis_cache_db | string | `"1"` | | | supersetNode.connections.redis_celery_db | string | `"0"` | | diff --git a/helm/superset/templates/_helpers.tpl b/helm/superset/templates/_helpers.tpl index a4f9b65f148..05e30da4534 100644 --- a/helm/superset/templates/_helpers.tpl +++ b/helm/superset/templates/_helpers.tpl @@ -96,7 +96,18 @@ CACHE_CONFIG = { } DATA_CACHE_CONFIG = CACHE_CONFIG -SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{env('DB_USER')}:{env('DB_PASS')}@{env('DB_HOST')}:{env('DB_PORT')}/{env('DB_NAME')}" + +if os.getenv("SQLALCHEMY_DATABASE_URI"): + SQLALCHEMY_DATABASE_URI = os.getenv("SQLALCHEMY_DATABASE_URI") +else: + {{- if eq .Values.supersetNode.connections.db_type "postgresql" }} + SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{os.getenv('DB_USER')}:{os.getenv('DB_PASS')}@{os.getenv('DB_HOST')}:{os.getenv('DB_PORT')}/{os.getenv('DB_NAME')}" + {{- else if eq .Values.supersetNode.connections.db_type "mysql" }} + SQLALCHEMY_DATABASE_URI = f"mysql+mysqldb://{os.getenv('DB_USER')}:{os.getenv('DB_PASS')}@{os.getenv('DB_HOST')}:{os.getenv('DB_PORT')}/{os.getenv('DB_NAME')}" + {{- else }} + {{ fail (printf "Unsupported database type: %s. Please use 'postgresql' or 'mysql'." .Values.supersetNode.connections.db_type) }} + {{- end }} + SQLALCHEMY_TRACK_MODIFICATIONS = True class CeleryConfig: diff --git a/helm/superset/values.yaml b/helm/superset/values.yaml index 371abecda1e..65d4bda9434 100644 --- a/helm/superset/values.yaml +++ b/helm/superset/values.yaml @@ -289,6 +289,8 @@ supersetNode: enabled: false ssl_cert_reqs: CERT_NONE # 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") + db_type: "postgresql" db_host: "{{ .Release.Name }}-postgresql" db_port: "5432" db_user: superset