dosubot[bot] commented on issue #29940:
URL: https://github.com/apache/superset/issues/29940#issuecomment-2287783997
<!-- Greeting -->
Hey there, @MEclipse1! I'm here to assist you with any bugs, questions, or
contributions you have. Let's tackle this together! 🤖
<!-- Answer -->
To resolve the `AttributeError: 'Template' object has no attribute 'strip'`
issue, you need to ensure that the `stripped` attribute is accessed correctly.
The `stripped` method should be accessed as an attribute, not as a method.
Here is the corrected code snippet:
```python
rendered_query = sql_template_processor.process_template(
parsed_query.stripped, **execution_context.template_params
)
```
Additionally, ensure that the `parsed_query` object is correctly
instantiated and that the `stripped` attribute is properly defined within the
`ParsedQuery` class. This change should resolve the `AttributeError` you are
encountering.
Refer to the `superset/models/sql_lab.py` file for more context on how SQL
parsing and template processing are handled in Apache Superset. The
`process_template` method in the `BaseTemplateProcessor` class is responsible
for processing SQL templates, and it uses the Jinja environment to render the
templates. Make sure your `parsed_query` object and its attributes are
compatible with this method
<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/sql_parse.py)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/superset/jinja_context.py)</sup><sup>[[4]](https://github.com/apache/superset/blob/master/superset/models/sql_lab.py)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
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]