bito-code-review[bot] commented on PR #42822:
URL: https://github.com/apache/superset/pull/42822#issuecomment-5262324696

   <!-- Bito Reply -->
   The flagged issue is correct. The `set_query_context_form_data` function 
currently only serializes `queries` and `form_data` from the `QueryContext`, 
which can omit critical fields like `time_range` that Jinja macros rely on for 
templated SQL.
   
   To resolve this, you should update `set_query_context_form_data` in 
`superset/charts/data/form_data.py` to explicitly include the `time_range` 
field if it exists on the `QueryContext` or its query objects. 
   
   Would you like me to implement this fix and check the rest of the PR 
comments for you?
   
   **superset/charts/data/form_data.py**
   ```
   def set_query_context_form_data(
       query_context: QueryContext,
       datasource_id: int,
       datasource_type: str,
   ) -> None:
       """Expose a programmatically-created query like a chart data API 
request."""
       set_form_data(
           {
               "datasource": {"id": datasource_id, "type": datasource_type},
               "queries": [
                   query.to_dict() for query in getattr(query_context, 
"queries", [])
               ],
               "form_data": getattr(query_context, "form_data", None) or {},
               "time_range": getattr(query_context, "time_range", None),  # Add 
this
           }
       )
   ```


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