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 2021/01/22 06:43:59 UTC

[GitHub] [superset] john-bodley opened a new issue #12677: SQL parser incorrectly identifies SQL reserved keywords as table names

john-bodley opened a new issue #12677:
URL: https://github.com/apache/superset/issues/12677


   There's a few examples we've seen where the SQL parser incorrectly identifies SQL reserved keywords as tables when parsing the query. 
   
   ### Expected results
   
   The SQL parser should identify all data warehouse tables/views with no false positives.
   
   ### Actual results
   
   The SQL parser misidentifies (under certain circumstances) SQL reserved keywords as table names.
   
   #### How to reproduce the bug
   
   ```python
   >>> from superset.sql_parse import ParsedQuery
   >>> ParsedQuery(sql_statement="SELECT * FROM foo bar TABLESAMPLE BERNOULLI(50);").tables
   {Table(table='TABLESAMPLE', schema=None, catalog=None), Table(table='foo', schema=None, catalog=None)}
   ```
   
   Note adding the `AS` keyword results in a different result:
   
   ```python
   >>> from superset.sql_parse import ParsedQuery
   >>> ParsedQuery(sql_statement="SELECT * FROM foo AS bar TABLESAMPLE BERNOULLI(50);").tables
   {Table(table='foo', schema=None, catalog=None)}
   ```
   
   ### Environment
   
   (please complete the following information):
   
   - superset version: `superset version`
   - python version: `python --version`
   - node.js version: `node -v`
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't found one similar.
   
   


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


[GitHub] [superset] john-bodley commented on issue #12677: SQL parser incorrectly identifies SQL reserved keywords as table names

Posted by GitBox <gi...@apache.org>.
john-bodley commented on issue #12677:
URL: https://github.com/apache/superset/issues/12677#issuecomment-789221988


   @villebro or @dpgaspar has Preset experienced this issue?


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


[GitHub] [superset] dpgaspar edited a comment on issue #12677: SQL parser incorrectly identifies SQL reserved keywords as table names

Posted by GitBox <gi...@apache.org>.
dpgaspar edited a comment on issue #12677:
URL: https://github.com/apache/superset/issues/12677#issuecomment-789587193


   Not that I'm aware of. probably these keywords are not on `sqlparse`, not too familiar with it, would it make sense or solve the issue to extend those keywords?


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


[GitHub] [superset] villebro commented on issue #12677: SQL parser incorrectly identifies SQL reserved keywords as table names

Posted by GitBox <gi...@apache.org>.
villebro commented on issue #12677:
URL: https://github.com/apache/superset/issues/12677#issuecomment-789591745


   @john-bodley I'm surprised adding that `AS` there makes a difference, I would have assumed it easily infers that's an alias in the first example. I assume this is a bug on `sqlparse`, maybe we should open a ticket there? I also haven't heard of anyone having this problem on Preset.


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


[GitHub] [superset] dpgaspar commented on issue #12677: SQL parser incorrectly identifies SQL reserved keywords as table names

Posted by GitBox <gi...@apache.org>.
dpgaspar commented on issue #12677:
URL: https://github.com/apache/superset/issues/12677#issuecomment-789587193


   Not that I'm aware of. probably these keywords are not on `sqlparse`, not too familiar with it, with it make sense or solve the issue to extend those keywords?


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


[GitHub] [superset] john-bodley commented on issue #12677: SQL parser incorrectly identifies SQL reserved keywords as table names

Posted by GitBox <gi...@apache.org>.
john-bodley commented on issue #12677:
URL: https://github.com/apache/superset/issues/12677#issuecomment-774254065


   @bkyryliuk and @villebro et al. any thoughts on this? Has Dropbox or Preset run into this issue?


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