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



### 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: [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]