thalmis-zt opened a new issue, #31956:
URL: https://github.com/apache/superset/issues/31956

   ### Bug description
   
   **OBJECTIVE:**
   Create a chart which can be embedded in an external  website. The chart 
should be filterable by passing filter values as url params.
   
   **STEPS FOLLOWED:**
   Created an sql query in SQL lab with jinja templating to allow custom url 
params. 
   
   ```sql
   SELECT rseti,course_id,state, course_name
   FROM course_overview
   WHERE state = '{{ url_param("state_value","238") }}' AND course_name <= 
'{{url_param("course_name","12")}}'
   ```
   
   Saved the query and Hit create chart
   
![Image](https://github.com/user-attachments/assets/48b267bb-77dc-47f2-9afc-d8b9dae722ea)
   
   
   Named the chart as “Demo Chart” and saved it.
   
![Image](https://github.com/user-attachments/assets/29b0bf66-c801-4df6-9d77-d2016fe9d66c)
   
   
   Copied the embed src and pasted in a new tab to view the chart.
   
![Image](https://github.com/user-attachments/assets/cd1559bd-e0a4-42b5-a65b-b5e9dea730f6)
   
   
   Chart is working fine as expected, with the `state_value` param filter being 
applied.
   
![Image](https://github.com/user-attachments/assets/e894be36-967d-4936-8271-cd7b9c04f4bb)
   
   
   Now, suppose I wish to edit the chart at a later point, which is best done 
by editing the sql query itself.
   To do that, I go to **Charts menu** in Superset UI and click on the desired 
chart. 
   
![Image](https://github.com/user-attachments/assets/515f96f1-660e-4420-b537-9938d180e008)
   
   
   In chart Explore page, I select the **View in SQL Lab** option
   
![Image](https://github.com/user-attachments/assets/cc457df5-089a-4de6-a3c6-c6e6d7924c59)
   
   
   I modified the query , to avoid the rseti column ( as below)
   ```sql
   SELECT course_id,state, course_name
   FROM course_overview
   WHERE state = '{{ url_param("state_value","238") }}' AND course_name <= 
'{{url_param("course_name","12")}}'
   
   ```
   
   
![Image](https://github.com/user-attachments/assets/9e125348-eaae-406d-a8b5-e101cad8b8a6)
   
   
   Satisfied with the results, I hit **Save** button. Got a message saying 
query has been saved. 
   Now, I go back to the tab where the earlier embed src is used, expecting 
that the ‘rseti’ column would have been removed from there as well. But, it 
isnt.
   
   
![Image](https://github.com/user-attachments/assets/8e5271cd-e98b-4d6b-ba96-bfa6af62766d)
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   3.10
   
   ### Node version
   
   18 or greater
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   Superset logs
   **No errors found**. Adding it in case it helps.
   
   2025-01-22 13:04:56,717:DEBUG:superset.sql_parse:Parsing with sqlparse 
statement: SELECT rseti AS rseti,
   superset_app          |        course_id AS course_id,
   superset_app          |        state AS state,
   superset_app          |        course_name AS course_name
   superset_app          | FROM
   superset_app          |   (SELECT rseti,
   superset_app          |           course_id,
   superset_app          |           state,
   superset_app          |           course_name
   superset_app          |    FROM course_overview
   superset_app          |    WHERE state = '263'
   superset_app          |      AND course_name <= '12') AS virtual_table    
   superset_app          | LIMIT 1000
   
   "POST 
   /superset/log/?explode=events HTTP/1.1" 200 1 
"http://localhost:8088/superset/explore/p/pP0mYgvz2Jb/?state_value=263&standalone=1&height=400";
   
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
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: notifications-unsubscr...@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to