You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/09/22 21:41:36 UTC

[GitHub] [superset] shawnzhu edited a comment on issue #16796: Db2 is not listed when trying to create new database connection

shawnzhu edited a comment on issue #16796:
URL: https://github.com/apache/superset/issues/16796#issuecomment-925351009


   ## Debugging
   
   I've located the problem to these lines of code:
   
   https://github.com/apache/superset/blob/63aadd3fe492c39d8949fe2510bd521669e6869d/superset/db_engine_specs/__init__.py#L132-L146
   
   The problem is it only recognizes driver by engine name, not engine alias. The fact is the SQLAlchemy dialect for Db2 has engine name `ibm_db_sa` while the latest name `db2` is listed in its entrypoints. So when loading installed drivers, it will populates `drivers` with key `ibm_db_sa`, but when populating `available_engines`, it only use the engine name `db2`.
   
   If I revert https://github.com/apache/superset/pull/14295 it starts to work.
   
   Or adding the below logic for function `get_available_engine_specs()`:
   
   ```Python
       for engine_spec in load_engine_specs():
           driver = drivers[engine_spec.engine]
           # support lookup driver via engine aliases.
           if not driver and engine_spec.engine_aliases:
               for alias in engine_spec.engine_aliases:
                   driver = drivers[alias]
                   if driver:
                       break
   
           available_engines[engine_spec] = driver
   ```
   
   So either option works for me in my dev environment.
   
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org