tadeha commented on code in PR #34327:
URL: https://github.com/apache/superset/pull/34327#discussion_r2237212129


##########
helm/superset/templates/_helpers.tpl:
##########
@@ -96,7 +96,13 @@ 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 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 }}

Review Comment:
   Good idea. I agree it makes sense to check `SQLALCHEMY_DATABASE_URI` first 
for flexibility. That said, I think it’s still useful to keep the current 
templated fallback in place for cases where users prefer setting individual 
`DB_*` env vars. This way, we support both approaches. Wdyt?
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to