liang-wenjie opened a new pull request, #43700:
URL: https://github.com/apache/superset/pull/43700

   ### SUMMARY
   
   Fix native SQLAlchemy dialect discovery after the SQLAlchemy 2 upgrade.
   
   `get_available_engine_specs()` still called the SQLAlchemy 1.4 
`dialect.dbapi()` API. Native SQLAlchemy 2 dialects expose `import_dbapi()` 
instead, so discovery logged an `AttributeError` and silently omitted installed 
drivers. For example, MySQL did not appear in `/api/v1/database/available/` 
even when `mysqlclient` was installed.
   
   Use `import_dbapi()` when available and retain `dbapi()` as a fallback for 
older SQLAlchemy dialects. Add a regression test covering a native SQLAlchemy 2 
MySQL dialect.
   
   Fixes #43699
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Not applicable. This changes backend driver discovery without UI changes.
   
   ### TESTING INSTRUCTIONS
   
   1. Run `pytest tests/unit_tests/db_engine_specs/test_init.py` and verify all 
tests pass (`5 passed`).
   2. Run Ruff formatting/lint checks on the two changed files.
   3. Run Pylint on `superset/db_engine_specs/__init__.py`.
   4. With `mysqlclient` installed, request `/api/v1/database/available/` and 
verify MySQL is returned with the `mysqldb` driver.
   
   Local validation:
   
   - `pytest tests/unit_tests/db_engine_specs/test_init.py -q`: 5 passed
   - `ruff format` and `ruff check`: passed
   - Pylint: 10.00/10
   - Remaining applicable pre-commit hooks: passed
   - Full Windows mypy hook is blocked by the existing 
`signal.SIGALRM`/`signal.alarm` platform errors in `superset/utils/core.py`; CI 
runs this check on Linux.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: #43699
   - [ ] 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: [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