dosubot[bot] commented on issue #36067: URL: https://github.com/apache/superset/issues/36067#issuecomment-3523278674
<!-- Answer --> "analyze" isn't a protected word in Superset itself, but it is a reserved keyword in Trino as recognized by sqlglot, which Superset uses for SQL parsing. The parse error happens because the schema name isn't quoted, so sqlglot treats "analyze" as a keyword instead of an identifier ([source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/sql/parse.py#L56-L703)). Superset relies on the `quote_table` method (in `BaseEngineSpec`) to quote schema, table, and catalog names using the SQLAlchemy dialect's quoting rules, but there's no logic to automatically detect and quote reserved keywords like "analyze" ([source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/base.py#L2181-L2196)). If quoting is skipped or not applied consistently, reserved keywords will break parsing. To investigate a fix, look at the SQL generation and formatting logic—especially in `superset/sql/parse.py`, the Trino engine spec, and how/when `quote_table` is called. Ensuring that all schema/table/catalog names are properly quoted before parsing would prevent this issue. If the problem persists due to how sqlglot handles reserved words, it may also be worth raising with sqlglot upstream. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/75598f49-39da-417d-ae47-05b25dd32c0d?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/75598f49-39da-417d-ae47-05b25dd32c0d?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/75598f49-39da-417d-ae47-05b25dd32c0d?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/75598f49-39da-417d-ae47-05b25dd32c0d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/75598f49-39da-417d-ae47-05b25dd32c0d?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/75598f49-39da-417d-ae47-05b25dd32c0d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/75598f49-39da-417d-ae47-05b25dd32c0d?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=githu b) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/36067) -- 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]
