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

   <!-- Answer -->
   This error happens because Superset uses a hardcoded mapping 
(SQLGLOT_DIALECTS) to associate each database engine with a SQLGlot dialect for 
SQL parsing. If your engine (like TDengine, which uses "taosws") isn't in this 
mapping, Superset defaults to a generic dialect that doesn't recognize 
TDengine-specific functions like TIMETRUNCATE. As a result, when you try to use 
time grains or chart features that generate SQL with TIMETRUNCATE, the parser 
fails before the query even reaches your database, even though TDengine itself 
supports the syntax 
[[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/sql/parse.py#L56-L1216)].
   
   To support a new engine, you need to (1) ensure there's a corresponding 
EngineSpec (which TDengine has), (2) add a dialect mapping for your engine in 
SQLGLOT_DIALECTS, and (3) ideally, have a matching dialect in SQLGlot itself. 
Without this, any SQL function or syntax not recognized by the default parser 
will cause errors in charts and dataset creation 
[[source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/tdengine.py#L27-L44)].
   
   A temporary workaround is to force the parser to use a similar dialect (like 
MySQL) by editing the _parse function in superset/sql/parse.py, but this is not 
robust and may break other features. The long-term fix is to add proper dialect 
support for your engine in both Superset and SQLGlot. There is also community 
interest in making it easier to register custom functions or dialects via 
configuration, but this isn't available yet.
   
   For now, if you need to use TDengine or another unmapped engine, you'll need 
to extend SQLGLOT_DIALECTS and possibly contribute a dialect to SQLGlot for 
full support.
   
   
   <!-- 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/ee384e8b-53ce-4084-9dbd-a13f3f1ba35c?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/ee384e8b-53ce-4084-9dbd-a13f3f1ba35c?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/ee384e8b-53ce-4084-9dbd-a13f3f1ba35c?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/ee384e8b-53ce-4084-9dbd-a13f3f1ba35c?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/ee384e8b-53ce-4084-9dbd-a13f3f1ba35c?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/ee384e8b-53ce-4084-9dbd-a13f3f1ba35c?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/ee384e8b-53ce-4084-9dbd-a13f3f1ba35c?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat
 with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=githu
 b)&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/36068)


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