SamraHanifCareem opened a new issue, #28455: URL: https://github.com/apache/superset/issues/28455
### Bug description In the **SQL lab**, when executing statements, comments are stripped in **sql_lab.py** before sending the query to the db_engine. However, this causes discrepancies in error referencing. _For example, if there's an error in the SQL query (e.g., invalid SQL), the incorrect line number is provided._ This issue also affects **Validators**. Any solutions or suggestions to resolve this? In sql_lab.py: `parsed_query = ParsedQuery(rendered_query, strip_comments=True)` **In superset:** ``` 1. select * 2. 3. -- comment 1 4. 5. --comment 2 6. 7. from abc.xyz 8. limits 20 ``` Now in the above query, superset strips the comments and send it to db_engine and the engine will get: ``` 1. select * 2. 3. 4. 5. from abc.xyz 6. limits 20 ``` > The db_engine will return error at: **line 6** > The actual error in superset will be at: **line 8** ### How to reproduce the bug - Go to Sql Lab - Select any database - Write invalid query - Execute the query by clicking "Run" ### Screenshots/recordings _No response_ ### Superset version master / latest-dev ### Python version 3.9 ### Node version 16 ### Browser Chrome ### Additional context _No response_ ### 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. - [ ] 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]
