alexclavel-ocient opened a new issue, #22946: URL: https://github.com/apache/superset/issues/22946
As it stands, the CTE_ALIAS used in [superset/connectors/sqla/models.py ](https://github.com/apache/superset/blob/b410dbb5dd510f1ed1dce6b2d0e114dda263eedb/superset/connectors/sqla/models.py#L924)cannot be changed by the db engine spec. Instead, it pulls the value from the [base model](https://github.com/apache/superset/blob/b410dbb5dd510f1ed1dce6b2d0e114dda263eedb/superset/connectors/sqla/models.py#L99). This causes a problem for databases that cannot use the [default CTE_ALIAS](https://github.com/apache/superset/blob/b410dbb5dd510f1ed1dce6b2d0e114dda263eedb/superset/db_engine_specs/base.py#L89) 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 - [X] I have checked the superset logs for python stacktraces and included it here as text if there are any. - [X] I have reproduced the issue with at least the latest released version of superset. - [X] I have checked the issue tracker for the same issue and I haven't found one similar. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
