aminghadersohi opened a new pull request, #44686: URL: https://github.com/apache/superset/pull/44686
### SUMMARY `get_available_dialects()` loads every installed `sqlalchemy.dialects` entry point, which runs arbitrary module-level code in third-party packages. It already snapshots/restores `compiler.OPERATORS` around those loads. Some dialects (e.g. `kylinpy`) also rebind or extend SQLAlchemy's shared `IdentifierPreparer.reserved_words` set at import. After enumeration, every dialect that relies on the generic reserved words starts quoting ordinary identifiers such as `name`, `type`, `level` or `source`. On case-folding databases, quoted lowercase identifiers are case-sensitive, so they stop matching columns created unquoted. For example, on a Firebird dialect that hasn't connected yet: - before enumeration: `SELECT p.id, p.name FROM p` returns rows - after enumeration: `SELECT p.id, p."name" FROM p` fails with `Column unknown P.name` This change extends the existing snapshot/restore in the same `finally` block. It restores both the class attribute binding and the contents of the original set. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A ### TESTING INSTRUCTIONS `pytest tests/unit_tests/db_engine_specs/test_init.py`. The new parametrized test uses a fake entry point that either rebinds or mutates `reserved_words` in place. It asserts that the original set object and its contents are restored, and that compiled SQL for the default and PostgreSQL dialects is unchanged. The test fails without the fix. ### ADDITIONAL INFORMATION - [ ] 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 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
