rusackas opened a new pull request, #41492: URL: https://github.com/apache/superset/pull/41492
### SUMMARY Follow-up to #41199. That PR taught SQL Lab autocomplete to quote table identifiers that aren't simple (spaces, punctuation, leading digits), but it always used ANSI double quotes and called out dialect-specific quoting as a reasonable follow-up. On engines that don't use ANSI double quotes for identifiers, inserting `"COVID Vaccines"` still fails to parse. This plumbs the active database backend into the `quoteIdentifier` helper so the inserted identifier uses the right quote characters: - MySQL / MariaDB -> backticks: `` `COVID Vaccines` `` - SQL Server (`mssql`) -> square brackets: `[COVID Vaccines]` - everything else -> ANSI double quotes: `"COVID Vaccines"` (unchanged) Embedded quote characters are escaped by doubling (for SQL Server only the closing bracket needs it). Simple identifiers are still inserted as-is, and the human-readable dropdown label is unchanged. The backend is read from `sqlLab.databases[dbId].backend`, the same source `useAnnotations` already uses. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A - logic change covered by unit tests. ### TESTING INSTRUCTIONS 1. In SQL Lab, connect to a MySQL database with a table whose name needs quoting (e.g. a name containing a space). 2. Pick it from the autocomplete dropdown and confirm it is inserted with backticks (`` `COVID Vaccines` ``) and runs. 3. Repeat against SQL Server and confirm square brackets (`[COVID Vaccines]`). 4. Confirm Postgres/other engines still get ANSI double quotes, and simple names stay unquoted. Unit tests in `useKeywords.test.ts` cover mysql, mariadb, mssql, and postgresql. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [x] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] 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: [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]
