You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/05/01 16:59:53 UTC

[GitHub] [incubator-superset] nytai commented on pull request #9692: [sqllab] fix, strip comments before parsing statements

nytai commented on pull request #9692:
URL: https://github.com/apache/incubator-superset/pull/9692#issuecomment-622471036


   The issue is that `sqlparse` is returning 2 statements when the statements look like 
   ```sql
   select * from table;
   -- comment
   ```
   I suspect is splits along the `;`.
   [The logic that determines if the statement is DML](https://github.com/preset-io/incubator-superset/blob/master/superset/sql_parse.py#L117) is just checking that all statements are "SELECT". The second statement is a comment, hence it's not SELECT, therefore it fails the is DML test. What this PR does is it strips comments before feeding the statements to `sqlparse` so we're only parsing actual SQL statements and not comments. 


----------------------------------------------------------------
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.

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



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