You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2023/10/03 21:34:45 UTC

[superset] branch robust_has_table_query updated: Fix query error

This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch robust_has_table_query
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/robust_has_table_query by this push:
     new 75c9f52bb3 Fix query error
75c9f52bb3 is described below

commit 75c9f52bb374994463316196f42fda622da29105
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Tue Oct 3 14:34:20 2023 -0700

    Fix query error
---
 superset/models/helpers.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/superset/models/helpers.py b/superset/models/helpers.py
index 81650c2dd6..8100559ba7 100644
--- a/superset/models/helpers.py
+++ b/superset/models/helpers.py
@@ -123,7 +123,13 @@ def validate_adhoc_subquery(
         # build a proper SQL query from the expression for sqloxide
         sql = f"SELECT {expression}"
 
-        if has_table_query(sql, sqla_dialect):
+        try:
+            queries_table = has_table_query(sql, sqla_dialect)
+        except ValueError:
+            # if we can't parse the query, assume yes
+            queries_table = True
+
+        if queries_table:
             if not is_feature_enabled("ALLOW_ADHOC_SUBQUERY"):
                 raise SupersetSecurityException(
                     SupersetError(