PedroMartinSteenstrup opened a new issue, #29466:
URL: https://github.com/apache/superset/issues/29466

   ### Bug description
   
   Using sql_mutator to append a comment to queries such as `-- Superset query 
context '{"user": "superset.admin" }'` (dash dash followed by the object to 
parse later)
   - the view query menu item in dashboards will render `Expecting value: line 
1 column 1 (char 0)` 
   - the sqllab will error with `Statement 2 out of 2 Only SELECT statements 
are allowed against this database.`
   
   I've been using this "tagging" of queries for years, so I can definitely 
link it to something recent, and given the history of commits, I'm not sure 
what I should do: wait for a fix? or find another way to tag queries?
   
   https://github.com/apache/superset/pull/29248
   https://github.com/apache/superset/pull/28567
   https://github.com/apache/superset/pull/28363
   https://github.com/apache/superset/pull/27725
   
   
   
   ### How to reproduce the bug
   
   1. Alter sql_mutator following simplified version below
   ```
   def sql_mutator(sql, security_manager, database):
   [...]
       from superset.utils.core import QuerySource, get_username
       user_name = get_username()
   [...]
        q_suffix = f'Superset query context'
   [...]
        q_suffix = f'{q_suffix} \'{{"{{"}}"user": "{user_name}" {{"}}"}}\''
       return f"{sql} -- {q_suffix}"
   ```
   
   2a. Run following Sqllab query
   ```
   SELECT 1;
   --select 2;
   ```
   
   2b. Or, go to a dashboard and try to `View Query` one chart
   
   3. See results in screenshots
   
   ### Screenshots/recordings
   
   
![image](https://github.com/apache/superset/assets/24451974/2a23ca0f-3295-4322-9365-1931cd2d82ea)
   
![image](https://github.com/apache/superset/assets/24451974/dc756191-4cdb-4329-a842-e05da42b1c04)
   
![image](https://github.com/apache/superset/assets/24451974/bde5c90a-ce46-4256-9320-24e4b4ed5833)
   
   
   ### Superset version
   
   4.0.1
   
   ### Python version
   
   3.9
   
   ### Node version
   
   I don't know
   
   ### Browser
   
   Firefox
   
   ### Additional context
   
   I am running 4.0.2 from published docker image, as I thought this would 
bring a fix from the change in behavior introduced when we upgraded to 4.0.1rc.
   
   Could repeat the same error with Snowflake and Postgres.
   
   ### 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