-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sql Lab: Getting incorrect error line number in Superset while executing queries #28455
Comments
To address the issue of incorrect error line numbers in Superset's SQL Lab due to comments being stripped before query execution, consider the following approach:
This approach requires a good understanding of Superset's codebase and the behavior of the database engine regarding SQL execution and error reporting. For implementation details, you might need to refer to the
|
Oof... that's annoying. Assigning to @betodealmeida / @john-bodley who are (I think?) the most up to date on SQL parser migrations (i.e. SQLGlot) |
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:
Now in the above query, superset strips the comments and send it to db_engine and the engine will get:
How to reproduce the bug
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
The text was updated successfully, but these errors were encountered: