feat: Add "is_select_query" method to base engine spec to make it possible to override it (#15013)

This commit is contained in:
Mikhail Kumachev 2021-06-08 03:32:33 +03:00 committed by GitHub
parent cf15fe0d03
commit 11eef251b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -1254,6 +1254,14 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
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(

View File

@ -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):