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

DB engine specs cannot change the CTE_ALIAS variable #22946

Closed
3 tasks done
alexclavel-ocient opened this issue Feb 1, 2023 · 0 comments · Fixed by #22947
Closed
3 tasks done

DB engine specs cannot change the CTE_ALIAS variable #22946

alexclavel-ocient opened this issue Feb 1, 2023 · 0 comments · Fixed by #22947
Assignees
Labels
#bug Bug report

Comments

@alexclavel-ocient
Copy link
Contributor

As it stands, the CTE_ALIAS used in superset/connectors/sqla/models.py cannot be changed by the db engine spec. Instead, it pulls the value from the base model.

This causes a problem for databases that cannot use the default CTE_ALIAS of '__cte'. In particular, this alias starts with an underscore, which may not be supported

How to reproduce the bug

Create Chart on a dataset containing a CTE

Expected results

Generate query like:
WITH cte as (SELECT * from schema.table),
MY_CTE_ALIAS AS (SELECT * from cte)
SELECT id AS "id"
FROM MY_CTE_ALIAS
LIMIT 1000;

Actual results

WITH cte as (SELECT * from schema.table),
MY_CTE_ALIAS AS (SELECT * from cte)
SELECT id AS "id"
FROM __cte
LIMIT 1000;

Checklist

  • 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#bug Bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants