You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Vitor-Avila (via GitHub)" <gi...@apache.org> on 2025/11/13 05:11:56 UTC

[PR] fix: Use singlestoredb dialect for sqlglot [superset]

Vitor-Avila opened a new pull request, #36096:
URL: https://github.com/apache/superset/pull/36096

   ### SUMMARY
   The `sqlglot` dialect for Singlestore DB was set with `"singlestore"` (as opposed to `"singlestoredb"`) causing queries triggered from a `singlestoredb://` connection to use the generic parser, which would fail with parsing errors.
   
   This PR fixes the issue by updating the reference, and also using the `Singlestore` dialect (as opposed to using MySQL).
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   **Before**
   <img width="3420" height="1028" alt="image" src="https://github.com/user-attachments/assets/00a5c57a-b38a-4779-9a51-f64856e6151c" />
   
   **After**
   <img width="3434" height="1056" alt="image" src="https://github.com/user-attachments/assets/d0c19903-e0e0-48fe-ac55-5b4933099baa" />
   
   ### TESTING INSTRUCTIONS
   1. Create a `singlestoredb://` connection.
   2. Create a dataset.
   3. Create a chart, with a simple `MAX($column)` as the metric. Do not add a metric label.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix: Use singlestoredb dialect for sqlglot [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #36096:
URL: https://github.com/apache/superset/pull/36096#issuecomment-3525427369

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix: Use singlestoredb dialect for sqlglot [superset]

Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #36096:
URL: https://github.com/apache/superset/pull/36096#discussion_r2521527537


##########
superset/sql/parse.py:
##########
@@ -101,7 +102,7 @@
     "redshift": Dialects.REDSHIFT,
     "risingwave": Dialects.RISINGWAVE,
     "shillelagh": Dialects.SQLITE,
-    "singlestore": Dialects.MYSQL,
+    "singlestoredb": SingleStore,

Review Comment:
   ### Missing backward compatibility for SingleStore engine name <sub>![category Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The mapping key changed from 'singlestore' to 'singlestoredb' but there's no backward compatibility handling for existing configurations that may still use 'singlestore'.
   
   
   ###### Why this matters
   Existing Superset installations with SingleStore databases configured using the 'singlestore' engine name will suddenly fail to parse SQL correctly, as they will fall back to the default 'base' dialect instead of the proper SingleStore dialect. This could cause SQL parsing errors and incorrect query behavior.
   
   ###### Suggested change ∙ *Feature Preview*
   Add both mappings to maintain backward compatibility:
   ```python
   "singlestore": SingleStore,
   "singlestoredb": SingleStore,
   ```
   This ensures existing configurations continue to work while supporting the new naming convention.
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/54fd2978-c232-4567-99de-dcbdf0e4044e/upvote) [![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/54fd2978-c232-4567-99de-dcbdf0e4044e?what_not_true=true)  [![Not in Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/54fd2978-c232-4567-99de-dcbdf0e4044e?what_out_of_scope=true) [![Not in coding standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/54fd2978-c232-4567-99de-dcbdf0e4044e?what_not_in_standard=true) [![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/54fd2978-c232-4567-99de-dcbdf0e4044e)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:04a33b12-9ccb-46a2-87f7-2a71b1c26be0 -->
   
   
   [](04a33b12-9ccb-46a2-87f7-2a71b1c26be0)



##########
superset/sql/parse.py:
##########
@@ -33,6 +33,7 @@
     Dialect,
     Dialects,
 )
+from sqlglot.dialects.singlestore import SingleStore

Review Comment:
   ### Unnecessary module-level import overhead <sub>![category Performance](https://img.shields.io/badge/Performance-4f46e5)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The import of SingleStore dialect class is added at module level, which means it will be imported every time this module is loaded, even when SingleStore database is not being used.
   
   
   ###### Why this matters
   This creates unnecessary import overhead for all users of this module, regardless of whether they actually use SingleStore databases. The import will add to module loading time and memory usage even for applications that never interact with SingleStore.
   
   ###### Suggested change ∙ *Feature Preview*
   Consider using lazy importing by moving the import inside the code path where it's actually needed, or use a factory pattern that only imports the dialect when the specific engine is requested. For example:
   
   ```python
   def get_dialect(engine: str):
       if engine == "singlestoredb":
           from sqlglot.dialects.singlestore import SingleStore
           return SingleStore
       return SQLGLOT_DIALECTS.get(engine)
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/370b081a-1d69-4c51-8e93-86860eb4ef84/upvote) [![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/370b081a-1d69-4c51-8e93-86860eb4ef84?what_not_true=true)  [![Not in Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/370b081a-1d69-4c51-8e93-86860eb4ef84?what_out_of_scope=true) [![Not in coding standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/370b081a-1d69-4c51-8e93-86860eb4ef84?what_not_in_standard=true) [![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/370b081a-1d69-4c51-8e93-86860eb4ef84)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:1b078b5a-cb13-47e0-b36c-9edb9e1122d3 -->
   
   
   [](1b078b5a-cb13-47e0-b36c-9edb9e1122d3)



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix: Use singlestoredb dialect for sqlglot [superset]

Posted by "Vitor-Avila (via GitHub)" <gi...@apache.org>.
Vitor-Avila merged PR #36096:
URL: https://github.com/apache/superset/pull/36096


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix: Use singlestoredb dialect for sqlglot [superset]

Posted by "Vitor-Avila (via GitHub)" <gi...@apache.org>.
Vitor-Avila commented on code in PR #36096:
URL: https://github.com/apache/superset/pull/36096#discussion_r2524590889


##########
superset/sql/parse.py:
##########
@@ -33,6 +33,7 @@
     Dialect,
     Dialects,
 )
+from sqlglot.dialects.singlestore import SingleStore

Review Comment:
   Unsure why, but the `Singlestore` dialect is not listed [here](https://github.com/tobymao/sqlglot/blob/v27.15.2/sqlglot/dialects/dialect.py#L76-L110) (`v27.15.2` is the current `sqlglot` pinned version in Superset), so we have to import the dialect directly. I checked [the latest `sqlglot` version](https://github.com/tobymao/sqlglot/blob/v27.29.0/sqlglot/dialects/dialect.py#L78-L113) too but it's still the case.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix: Use singlestoredb dialect for sqlglot [superset]

Posted by "Vitor-Avila (via GitHub)" <gi...@apache.org>.
Vitor-Avila commented on code in PR #36096:
URL: https://github.com/apache/superset/pull/36096#discussion_r2524583448


##########
superset/sql/parse.py:
##########
@@ -101,7 +102,7 @@
     "redshift": Dialects.REDSHIFT,
     "risingwave": Dialects.RISINGWAVE,
     "shillelagh": Dialects.SQLITE,
-    "singlestore": Dialects.MYSQL,
+    "singlestoredb": SingleStore,

Review Comment:
   `singlestore` was actually incorrect there, so the dialect was not being used and instead the default dialect was used for Singlestore.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org