pizofreude commented on code in PR #36422:
URL: https://github.com/apache/superset/pull/36422#discussion_r2617206815


##########
superset/commands/database/validate_sql.py:
##########
@@ -62,6 +63,12 @@ def run(self) -> list[dict[str, Any]]:
         sql = self._properties["sql"]
         catalog = self._properties.get("catalog")
         schema = self._properties.get("schema")
+        template_params = self._properties.get("template_params") or {}
+
+        # Render Jinja templates to handle template syntax before validation
+        template_processor = get_template_processor(self._model)
+        sql = template_processor.process_template(sql, **template_params)

Review Comment:
   Could you add a brief comment or a tiny docstring explaining expected 
semantics of process_template here (e.g., whether it always returns a string, 
whether it may mutate the SQL, and what exceptions it may raise)? Also, please 
consider defensive handling/logging if process_template fails (so the 
validation endpoint can return a meaningful error instead of a 500).



-- 
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