Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNION ALL in CTE rises a read only error #25266

Closed
3 tasks done
nicolaspi opened this issue Sep 12, 2023 · 0 comments · Fixed by #25290
Closed
3 tasks done

UNION ALL in CTE rises a read only error #25266

nicolaspi opened this issue Sep 12, 2023 · 0 comments · Fixed by #25290
Assignees

Comments

@nicolaspi
Copy link

When using sqloxide, the logic for testing if a CTE is a select statement doesn't account for set operations.

How to reproduce the bug

SQLLab: WITH t AS ( SELECT 1 UNION ALL SELECT 2 ) SELECT * FROM t

Python interpreter:

import superset.sql_parse as sql_parse
assert sql_parse.sqloxide_parse is not None, "The case only fails when sqloxide is used"

parsed_query = sql_parse.ParsedQuery("""WITH t AS (
SELECT 1 UNION ALL SELECT 2
)
SELECT * FROM t""")

print("Is select:", parsed_query.is_select())

Expected results

Interpreter: Is select: True

Actual results

SQLLAb: Only SELECT statements are allowed against this database.
Interpreter: Is select: False

Environment

The problem arises only when sqloxide is installed.

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants