dosubot[bot] commented on issue #36939:
URL: https://github.com/apache/superset/issues/36939#issuecomment-3717485419

   <!-- Answer -->
   Superset sends your SQL statements to StarRocks as-is and relies on the 
StarRocks SQLAlchemy driver and the database itself to support statements like 
`SHOW TABLES`, `SHOW DATABASES`, `SHOW CREATE TABLE`, `REFRESH EXTERNAL TABLE`, 
and `DROP TABLE ... FORCE`—there’s no extra filtering or blocking in Superset’s 
code for these statements[^1][^2][^3]. If these statements fail in SQL Lab but 
SELECT works, it’s likely due to either the StarRocks driver not supporting 
them via SQLAlchemy, or the Superset SQL parser (sqlglot) not recognizing the 
syntax and rejecting the query before execution[^4][^5].
   
   To narrow it down, try running the same statements directly using a 
SQLAlchemy session or the StarRocks client. If they work there but not in 
Superset, check for any error messages in Superset’s logs when you run these 
statements—those details will help pinpoint if the issue is with SQL parsing or 
the driver. If you see a parsing error, it’s likely sqlglot not handling the 
statement; if you see a driver/database error, it’s likely a limitation of the 
StarRocks SQLAlchemy dialect.
   
   [^1]: [StarRocks engine spec does not block these 
statements](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/starrocks.py#L34-L251)
   [^2]: [Superset SQL Lab executes SQL as-is, no statement 
filtering](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/commands/sql_lab/execute.py#L58-L243)
   [^3]: [SQL Lab executor sends rendered SQL to the 
driver](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/sqllab/sql_json_executer.py#L51-L202)
   [^4]: [Superset uses sqlglot to parse and classify statements; unrecognized 
syntax can cause 
rejection](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/sql/parse.py#L57-L1331)
   [^5]: [Statements like SHOW/REFRESH are parsed as Command nodes; if not 
recognized, Superset may reject 
them](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/sql/parse.py#L57-L1331)
   
   
   <!-- 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/e2501581-cd1e-430f-b848-df9ff096b917?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/e2501581-cd1e-430f-b848-df9ff096b917?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/e2501581-cd1e-430f-b848-df9ff096b917?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/e2501581-cd1e-430f-b848-df9ff096b917?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/e2501581-cd1e-430f-b848-df9ff096b917?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/e2501581-cd1e-430f-b848-df9ff096b917?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/e2501581-cd1e-430f-b848-df9ff096b917?feedback_type=other)</sup>
   
   [![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Superset%20sends%20your%20SQL%20statements%20to%20StarRocks%20as-is%20and%20relies%20on%20the%20StarRocks%20SQLAlchemy%20driver%20and%20the%20database%20itself%20to%20support%20statements%20like%20%60SHOW%20TABLES%60%2C%20%60SHOW%20DATABASES%60%2C%20%60SHOW%20CREATE%20TABLE%60%2C%20%60REFRESH%20EXTERNAL%20TABLE%60%2C%20and%20%60DROP%20TABLE%20...%20FORCE%60%E2%80%94there%E2%80%99s%20no%20extra%20filtering%20or%20blocking%20in%20Superset%E2%80%99s%20code%20for%20these%20statements%5B%5E1%5D%5B%5E2%5D%5B%5E3%5D.%20If%20these%20statements%20fail%20in%20SQL%20Lab%20but%20SELECT%20works%2C%20it%E2%80%99s%20likely%20due%20to%20either%20the%20StarRocks%20driver%20not%20supporting%20them%20via%20SQLAlchemy%2C%20or%20the%20Superset%20SQL%20parser%20%28sqlgl
 
ot%29%20not%20recognizing%20the%20syntax%20and%20rejecting%20the%20query%20before%20execution%5B%5E4%5D%5B%5E5%5D.%0A%0ATo%20narrow%20it%20down%2C%20try%20running%20the%20same%20statements%20directly%20using%20a%20SQLAlchemy%20session%20or%20the%20StarRocks%20client.%20If%20they%20work%20there%20but%20not%20in%20Superset%2C%20check%20for%20any%20error%20messages%20in%20Superset%E2%80%99s%20logs%20when%20you%20run%20these%20statements%E2%80%94those%20details%20will%20help%20pinpoint%20if%20the%20issue%20is%20with%20SQL%20parsing%20or%20the%20driver.%20If%20you%20see%20a%20parsing%20error%2C%20it%E2%80%99s%20likely%20sqlglot%20not%20handling%20the%20statement%3B%20if%20you%20see%20a%20driver/database%20error%2C%20it%E2%80%99s%20likely%20a%20limitation%20of%20the%20StarRocks%20SQLAlchemy%20dialect.%0A%0A%5B%5E1%5D%3A%20%5BStarRocks%20engine%20spec%20does%20not%20block%20these%20statements%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/d
 
b_engine_specs/starrocks.py%23L34-L251%29%0A%5B%5E2%5D%3A%20%5BSuperset%20SQL%20Lab%20executes%20SQL%20as-is%2C%20no%20statement%20filtering%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/commands/sql_lab/execute.py%23L58-L243%29%0A%5B%5E3%5D%3A%20%5BSQL%20Lab%20executor%20sends%20rendered%20SQL%20to%20the%20driver%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/sqllab/sql_json_executer.py%23L51-L202%29%0A%5B%5E4%5D%3A%20%5BSuperset%20uses%20sqlglot%20to%20parse%20and%20classify%20statements%3B%20unrecognized%20syntax%20can%20cause%20rejection%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/sql/parse.py%23L57-L1331%29%0A%5B%5E5%5D%3A%20%5BStatements%20like%20SHOW/REFRESH%20are%20parsed%20as%20Command%20nodes%3B%20if%20not%20recognized%2C%20Superset%20may%20reject%20them%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1
 ed3b063ffe45377799c/superset/sql/parse.py%23L57-L1331%29)&nbsp;[![Join 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/36939)


-- 
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]

Reply via email to