aminghadersohi commented on code in PR #43110:
URL: https://github.com/apache/superset/pull/43110#discussion_r3786566615
##########
superset/db_engine_specs/__init__.py:
##########
@@ -165,7 +165,24 @@ def get_available_engine_specs() ->
dict[type[BaseEngineSpec], set[str]]: # noq
except Exception as ex: # pylint: disable=broad-except
logger.debug("Unable to load SQLAlchemy dialect %s: %s", ep.name,
ex)
else:
- backend = dialect.name
+ # A third-party entry point can load successfully yet not resolve
to
+ # a usable dialect -- e.g. a malformed ``name = pkg:module`` entry
+ # point yields a module, which has no ``name``. Reading ``.name``
+ # unguarded here would raise and abort the whole enumeration,
taking
+ # down every page that builds the bootstrap payload rather than
just
+ # marking that one connector unavailable. Skip it with a warning
+ # instead, mirroring the defensiveness of the native-dialect loop
+ # above.
+ backend = getattr(dialect, "name", None)
+ if not isinstance(backend, (str, bytes)):
+ logger.warning(
+ "Skipping SQLAlchemy dialect entry point %r: %r did not "
+ "resolve to a usable dialect (%r)",
+ ep.name,
+ ep.value,
+ dialect,
+ )
+ continue
Review Comment:
Addressed in 4d49315412. Third-party entry points are now required to
resolve to a `DefaultDialect` subclass with a driver and a working `dbapi()`
implementation, matching the native-dialect checks. The regression test also
covers a named class that does not implement the dialect contract.
--
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]