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:34:37 UTC

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

shawnzhu opened a new issue #16796:
URL: https://github.com/apache/superset/issues/16796


   Once the SQLAlchemy dialect `ibm_db_sa` and driver (`ibm_db`) for Db2 installed, it should list Db2 as available database.
   
   ### Expected results
   
   When creating a new database, It should list Db2 as an available database.
   
   ### Actual results
   
   Although both `ibm_db_sa` and `ibm_db` is installed, it doesn't list Db2 as available database.
   
   #### Screenshots
   
   ![Screenshot from 2021-09-22 17-24-16](https://user-images.githubusercontent.com/1059372/134424727-082fdfb4-0d59-4d7e-a1b4-3f2ceabbc9b7.png)
   
   
   #### How to reproduce the bug
   
   1. Go to Menu 'Data'
   2. Click on 'Databases'
   3. Click the button '+ DATABASE'
   3. In the popup modal, select 'SUPPORTED DATABASES'
   4. `IBM Db2` should be listed but actually not
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version:
   - superset version: `1.3.0`
   - python version: `3.8.12`
   - node.js version: `v14.17.6`
   - any feature flags active:
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't found one similar.
   
   ### Additional context
   
   It works in Superset 1.2.0 but only appear in v1.3.0. So I found two causes:
   
   1. https://github.com/apache/superset/pull/15587
   2. https://github.com/apache/superset/pull/14295
   


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


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

Posted by GitBox <gi...@apache.org>.
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


[GitHub] [superset] junlincc commented on issue #16796: Db2 is not listed when trying to create new database connection

Posted by GitBox <gi...@apache.org>.
junlincc commented on issue #16796:
URL: https://github.com/apache/superset/issues/16796#issuecomment-925352490


   @shawnzhu Thanks so much for detailed repro steps and debugging. Please do open a PR with your proposed solution to fix forward. 🙏


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


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

Posted by GitBox <gi...@apache.org>.
shawnzhu commented 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 recognize 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


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

Posted by GitBox <gi...@apache.org>.
shawnzhu commented on issue #16796:
URL: https://github.com/apache/superset/issues/16796#issuecomment-926722530


   I can verify the fix from #16800 works locally from master branch.
   
   @junlincc @villebro thanks for the attention and fast response!


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


[GitHub] [superset] villebro commented on issue #16796: Db2 is not listed when trying to create new database connection

Posted by GitBox <gi...@apache.org>.
villebro commented on issue #16796:
URL: https://github.com/apache/superset/issues/16796#issuecomment-927727934


   Thanks for the fix @shawnzhu! Closing


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


[GitHub] [superset] villebro closed issue #16796: Db2 is not listed when trying to create new database connection

Posted by GitBox <gi...@apache.org>.
villebro closed issue #16796:
URL: https://github.com/apache/superset/issues/16796


   


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