apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
61.88k stars 13.55k forks source link

Unable to detect valid SELECT statement #29448

Open michael-s-molina opened 2 months ago

michael-s-molina commented 2 months ago

Bug description

Our query parser is unable to detect the following valid SELECT statement:

WITH my_table AS (
  SELECT
    *
  FROM public.cleaned_sales_data
)
SELECT
  *
FROM my_table

On SQL Lab, it throws Only SELECT statements are allowed against this database.

How to reproduce the bug

1 - Go to SQL Lab and try to execute the query 2 - Check the error message

Screenshots/recordings

Screenshot 2024-07-01 at 17 15 36

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

The error comes from: https://github.com/apache/superset/blob/028665030f7851f3db4e90ee5d483ddb09bf384c/superset/sql_parse.py#L926

Checklist

Habeeb556 commented 2 months ago

28145 is related I think, as applying the sql_parse.patch resolved this error for me.