mirror of
https://github.com/apache/superset.git
synced 2026-04-24 18:44:53 +00:00
fix sqlparse bug and refactor (#5768)
This commit is contained in:
@@ -11,7 +11,7 @@ import sqlparse
|
||||
from sqlparse.sql import Identifier, IdentifierList
|
||||
from sqlparse.tokens import Keyword, Name
|
||||
|
||||
RESULT_OPERATIONS = {'UNION', 'INTERSECT', 'EXCEPT'}
|
||||
RESULT_OPERATIONS = {'UNION', 'INTERSECT', 'EXCEPT', 'SELECT'}
|
||||
ON_KEYWORD = 'ON'
|
||||
PRECEDES_TABLE_NAME = {'FROM', 'JOIN', 'DESC', 'DESCRIBE', 'WITH'}
|
||||
|
||||
@@ -128,7 +128,7 @@ class SupersetQuery(object):
|
||||
if not table_name_preceding_token:
|
||||
continue
|
||||
|
||||
if item.ttype in Keyword:
|
||||
if item.ttype in Keyword or item.value == ',':
|
||||
if (self.__is_result_operation(item.value) or
|
||||
item.value.upper() == ON_KEYWORD):
|
||||
table_name_preceding_token = False
|
||||
|
||||
Reference in New Issue
Block a user