Skip to content

Commit

Permalink
feat: Add "is_select_query" method to base engine spec to make it pos…
Browse files Browse the repository at this point in the history
…sible to override it (apache#15013)
  • Loading branch information
Ceridan authored and cccs-RyanS committed Dec 17, 2021
1 parent 2db505c commit 8781493
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions superset/db_engine_specs/base.py
Expand Up @@ -1254,6 +1254,14 @@ def is_readonly_query(cls, parsed_query: ParsedQuery) -> bool:
or parsed_query.is_show()
)

@classmethod
def is_select_query(cls, parsed_query: ParsedQuery) -> bool:
"""
Determine if the statement should be considered as SELECT statement.
Some query dialects do not contain "SELECT" word in queries (eg. Kusto)
"""
return parsed_query.is_select()

@classmethod
@utils.memoized
def get_column_spec(
Expand Down
2 changes: 1 addition & 1 deletion superset/sql_lab.py
Expand Up @@ -217,7 +217,7 @@ def execute_sql_statement(
query.select_as_cta_used = True

# Do not apply limit to the CTA queries when SQLLAB_CTAS_NO_LIMIT is set to true
if parsed_query.is_select() and not (
if db_engine_spec.is_select_query(parsed_query) and not (
query.select_as_cta_used and SQLLAB_CTAS_NO_LIMIT
):
if SQL_MAX_ROW and (not query.limit or query.limit > SQL_MAX_ROW):
Expand Down

0 comments on commit 8781493

Please sign in to comment.