bito-code-review[bot] commented on PR #43110:
URL: https://github.com/apache/superset/pull/43110#issuecomment-5290667071

   <!-- Bito Reply -->
   The flagged issue is correct. The current implementation only checks for the 
existence of a `name` attribute, which is insufficient to guarantee that the 
loaded object is a valid SQLAlchemy dialect. To resolve this, you should verify 
that the loaded object is an instance of the expected SQLAlchemy dialect base 
class or implements the required dialect contract (e.g., having a `dbapi()` 
method or `driver` attribute) before registering it.
   
   Here is a concise implementation to add this validation:
   
   ```python
   from sqlalchemy.engine import Dialect
   
   # ... inside the loop ...
               backend = getattr(dialect, "name", None)
               if not isinstance(backend, (str, bytes)) or not 
isinstance(dialect, Dialect):
                   logger.warning(
                       "Skipping SQLAlchemy dialect entry point %r: %r did not "
                       "resolve to a valid SQLAlchemy dialect",
                       ep.name,
                       ep.value,
                   )
                   continue
   ```
   
   There are no other comments on this PR to address.
   
   **superset/db_engine_specs/__init__.py**
   ```
   backend = getattr(dialect, "name", None)
               if not isinstance(backend, (str, bytes)) or not 
isinstance(dialect, Dialect):
                   logger.warning(
                       "Skipping SQLAlchemy dialect entry point %r: %r did not "
                       "resolve to a valid SQLAlchemy dialect",
                       ep.name,
                       ep.value,
                   )
                   continue
   ```


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