codeant-ai-for-open-source[bot] commented on code in PR #41492:
URL: https://github.com/apache/superset/pull/41492#discussion_r3662203706


##########
superset/db_engine_specs/base.py:
##########
@@ -540,6 +540,15 @@ class BaseEngineSpec:  # pylint: 
disable=too-many-public-methods
     arraysize = 0
     max_column_name_length: int | None = None
 
+    # Characters used to quote identifiers (table/column names) that aren't 
simple.
+    # Defaults to ANSI double quotes; dialects that differ override these — 
e.g.
+    # MySQL/MariaDB use backticks and SQL Server uses square brackets. Embedded
+    # quote characters are escaped by doubling the closing character. These are
+    # surfaced to the client (see `get_public_information`) so identifier 
quoting
+    # stays owned by the engine spec rather than duplicated per client.
+    identifier_quote_start: str = '"'
+    identifier_quote_end: str = '"'

Review Comment:
   **Suggestion:** The ANSI default is incorrect for supported engines such as 
BigQuery, whose dialect requires backticks for quoted identifiers. Because 
`BigQueryEngineSpec` inherits these values without overriding them, SQL Lab 
will insert double-quoted names such as `"COVID Vaccines"`, which BigQuery 
cannot parse. Derive the quote characters from the SQLAlchemy dialect or add 
overrides for every supported non-ANSI engine before exposing this metadata. 
[api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ BigQuery autocomplete inserts invalid quoted table identifiers.
   - ⚠️ Tables with spaces or punctuation require manual SQL correction.
   - ⚠️ SQL Lab autocomplete usability is degraded for BigQuery users.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Configure a BigQuery database, which is represented by 
`BigQueryEngineSpec` at
   `superset/db_engine_specs/bigquery.py:221` and does not override the 
inherited identifier
   quote attributes.
   
   2. Request the database metadata through the database API;
   `superset/databases/api.py:1975` calls 
`engine_spec.get_public_information()`, which
   exposes the default values from `superset/db_engine_specs/base.py:2671-2674` 
as
   `identifier_quote: {"start": "\"", "end": "\""}`.
   
   3. Open that database in SQL Lab;
   `superset-frontend/src/SqlLab/components/EditorWrapper/index.tsx:285-295` 
invokes
   `useKeywords`, which reads the metadata at
   `superset-frontend/src/SqlLab/components/EditorWrapper/useKeywords.ts:75-83`.
   
   4. Select a BigQuery table with a non-simple name such as one containing a 
space. The
   table insertion path at `useKeywords.ts:198-201` and 
`useKeywords.ts:226-229` calls
   `quoteIdentifier`, producing `"COVID Vaccines"` because BigQuery's 
quoted-identifier
   syntax requires backticks, so the inserted autocomplete SQL fails to parse.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=f579f216336a45a3aacca253f712b51f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=f579f216336a45a3aacca253f712b51f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/db_engine_specs/base.py
   **Line:** 549:550
   **Comment:**
        *Api Mismatch: The ANSI default is incorrect for supported engines such 
as BigQuery, whose dialect requires backticks for quoted identifiers. Because 
`BigQueryEngineSpec` inherits these values without overriding them, SQL Lab 
will insert double-quoted names such as `"COVID Vaccines"`, which BigQuery 
cannot parse. Derive the quote characters from the SQLAlchemy dialect or add 
overrides for every supported non-ANSI engine before exposing this metadata.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41492&comment_hash=5f92e166c3015e0cab1b1684c5c346f1f910b2d3711a6c116f4fdf8227987e9a&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41492&comment_hash=5f92e166c3015e0cab1b1684c5c346f1f910b2d3711a6c116f4fdf8227987e9a&reaction=dislike'>👎</a>



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