justinpark commented on code in PR #35009:
URL: https://github.com/apache/superset/pull/35009#discussion_r2323849789
##########
superset/sqllab/query_render.py:
##########
@@ -74,6 +74,14 @@ def _validate(
sql_template_processor: BaseTemplateProcessor,
) -> None:
if is_feature_enabled("ENABLE_TEMPLATE_PROCESSING"):
+ original_sql = execution_context.query.sql.strip().strip(";")
+ if rendered_query == original_sql:
+ import re
+
+ function_pattern = r"\{\{\s*(ref|source|var|env_var)\s*\("
+ if re.search(function_pattern, original_sql, re.IGNORECASE):
+ return
Review Comment:
If I understand this code block correctly, the current code is designed to
skip the uncleared_variables check whenever there is a block in the Jinja
template that includes variable declarations.
This means the entire _validation() block becomes meaningless. To revise it
according to its intended purpose, I think the correct approach would be to
process the template after removing the comment blocks from the original_sql,
and then perform the uncleared_variable check.
--
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]