dosubot[bot] commented on issue #32912:
URL: https://github.com/apache/superset/issues/32912#issuecomment-2765271547
<!-- Answer -->
To resolve the "Parameter error" in your Jinja SQL query, ensure that all
template parameters are correctly defined and match the parameters set in the
"Set Parameters" section. The error message suggests checking for syntax errors
and ensuring parameter names are consistent across your SQL query and the
parameters you have set.
Make sure that all template parameters are surrounded by double braces, for
example, `{{ ds }}`. This is crucial for the correct interpretation of the
parameters in the query.
Here's a relevant excerpt from the code that handles this:
```py
PARAMETER_MISSING_ERR = __(
"Please check your template parameters for syntax errors and make sure "
"they match across your SQL query and Set Parameters. Then, try running "
"your query again."
)
```
The `_validate` method checks for undefined parameters:
```py
def _validate(
self,
execution_context: SqlJsonExecutionContext,
rendered_query: str,
sql_template_processor: BaseTemplateProcessor,
) -> None:
if is_feature_enabled("ENABLE_TEMPLATE_PROCESSING"):
syntax_tree = sql_template_processor.env.parse(rendered_query)
undefined_parameters = find_undeclared_variables(syntax_tree)
if undefined_parameters:
self._raise_undefined_parameter_exception(
execution_context, undefined_parameters
)
```
Ensure that all parameters used in your query are declared and match the
parameters provided in the execution context. If there are any undeclared
variables, they will trigger an error. Also, double-check your query for any
syntax errors near the reported error location
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/sqllab/query_render.py)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset/translations/nl/LC_MESSAGES/messages.po)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
---
<sup>Help Dosu learn! Give it feedback: [Great
Response](https://app.dosu.dev/response-feedback/0aea3c1c-4311-4423-b40e-6d402f4b6554?feedback_type=great_response)
| [Irrelevant
Answer](https://app.dosu.dev/response-feedback/0aea3c1c-4311-4423-b40e-6d402f4b6554?feedback_type=irrelevant_answer)
| [Incorrect
Sources](https://app.dosu.dev/response-feedback/0aea3c1c-4311-4423-b40e-6d402f4b6554?feedback_type=incorrect_sources)
| [Too
Verbose](https://app.dosu.dev/response-feedback/0aea3c1c-4311-4423-b40e-6d402f4b6554?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/0aea3c1c-4311-4423-b40e-6d402f4b6554?feedback_type=hallucination)
| [Bug
Report](https://app.dosu.dev/response-feedback/0aea3c1c-4311-4423-b40e-6d402f4b6554?feedback_type=bug_report)
|
[Other](https://app.dosu.dev/response-feedback/0aea3c1c-4311-4423-b40e-6d402f4b6554?feedback_type=other)</sup>
--
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]