This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 11eef25 feat: Add "is_select_query" method to base engine spec to
make it possible to override it (#15013)
11eef25 is described below
commit 11eef251b2348d1c895e70911ff4ad9d58e8cd19
Author: Mikhail Kumachev <[email protected]>
AuthorDate: Tue Jun 8 03:32:33 2021 +0300
feat: Add "is_select_query" method to base engine spec to make it possible
to override it (#15013)
---
superset/db_engine_specs/base.py | 8 ++++++++
superset/sql_lab.py | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/superset/db_engine_specs/base.py b/superset/db_engine_specs/base.py
index 75d0953..3f123c1 100644
--- a/superset/db_engine_specs/base.py
+++ b/superset/db_engine_specs/base.py
@@ -1255,6 +1255,14 @@ class BaseEngineSpec: # pylint:
disable=too-many-public-methods
)
@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(
cls,
diff --git a/superset/sql_lab.py b/superset/sql_lab.py
index 8329627..30cec61 100644
--- a/superset/sql_lab.py
+++ b/superset/sql_lab.py
@@ -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):