GitHub user stgztsw created a discussion: "view query" function in char editor 
doesn't works

I hava a virtual dataset like this using doris database.

with cet as(
  select 
    is_apply,
    core_attachment,
    english_name,
    attachment_name,
    attachment_number
  from udesk_cargo_management
  where 1=1
  {% if filter_values('is_apply') %}
    and is_apply in {{ filter_values('is_apply')|where_in }}
  {% endif %}
)
SELECT
  is_apply,
  count(1)
from cet
GROUP by is_apply

I can create chart with this dataset, but the "view query" function in char 
editor is doesn't work.
<img width="2338" height="1278" alt="image" 
src="https://github.com/user-attachments/assets/757469b4-b0ce-4822-8dfb-5f622834b65b";
 />

and error log is like this:
2025-09-19 
06:08:21,405:WARNING:superset.views.error_handling:SupersetErrorException
Traceback (most recent call last):
  File "/app/superset/sql/parse.py", line 553, in _parse
    statements = sqlglot.parse(script, dialect=dialect)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/sqlglot/__init__.py", line 102, 
in parse
    return Dialect.get_or_raise(read or dialect).parse(sql, **opts)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/sqlglot/dialects/dialect.py", 
line 1062, in parse
    return self.parser(**opts).parse(self.tokenize(sql), sql)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 1601, 
in parse
    return self._parse(
           ^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 1673, 
in _parse
    self.raise_error("Invalid expression / Unexpected token")
  File "/app/.venv/lib/python3.11/site-packages/sqlglot/parser.py", line 1714, 
in raise_error
    raise error
sqlglot.errors.ParseError: Invalid expression / Unexpected token. Line 1, Col: 
36.
  SELECT is_apply AS is_apply, `count(1)` AS `count(1)`
FROM (with cet as(
  select
    is_apply,
    core_attachment,
    english_name,

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/.venv/lib/python3.11/site-packages/flask/app.py", line 1484, in 
full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.11/site-packages/flask/app.py", line 1469, in 
dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/superset/views/base_api.py", line 120, in wraps
    duration, response = time_function(f, self, *args, **kwargs)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/superset/utils/core.py", line 1409, in time_function
    response = func(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^
  File 
"/app/.venv/lib/python3.11/site-packages/flask_appbuilder/security/decorators.py",
 line 109, in wraps
    return f(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/superset/utils/log.py", line 304, in wrapper
    value = f(*args, **kwargs)
            ^^^^^^^^^^^^^^^^^^
  File "/app/superset/sqllab/api.py", line 232, in format_sql
    result = SQLScript(model["sql"], model.get("engine")).format()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/superset/sql/parse.py", line 1231, in __init__
    self.statements = statement_class.split_script(script, engine)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/superset/sql/parse.py", line 591, in split_script
    cls(ast=ast, engine=engine) for ast in cls._parse(script, engine) if ast
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/superset/sql/parse.py", line 556, in _parse
    raise SupersetParseError(
superset.exceptions.SupersetParseError: Error parsing near '(' at line 1:36
180.169.129.210 - - [19/Sep/2025:06:08:21 +0000] "POST 
/api/v1/sqllab/format_sql/ HTTP/1.1" 422 663 
"http://139.196.8.69:8088/explore/?form_data_key=Yfnn1Y_hqEA&datasource_type=table&datasource_id=21&save_action=saveas&slice_id=7";
 "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, 
like Gecko) Chrome/139.0.0.0 Safari/537.36"


GitHub link: https://github.com/apache/superset/discussions/35205

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: 
notifications-unsubscr...@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to