HUE-8740 [sql] Add prompt for credentials to MySQL

Review Request #13756 - Created March 27, 2019 and submitted

Romain Rigaux
hue
master
HUE-8740
hue
jgauthier, johan, ranade, romain, weixia, yingc
commit 97bef7654bdab57dea259c2f86565c92e1d44c77
Author: Romain Rigaux <romain@cloudera.com>
Date:   Wed Mar 27 09:27:07 2019 -0700

    HUE-8740 [sql] Add prompt for credentials to MySQL

:100644 100644 1b6554a... 4b7ccfa... M	desktop/core/src/desktop/js/apps/notebook/app.js
:100644 100644 560da00... 9d3ebb5... M	desktop/core/src/desktop/js/apps/notebook/editorViewModel.js
:100644 100644 0c0923b... 80d4389... M	desktop/core/src/desktop/js/apps/notebook/notebook.js
:100644 100644 b9d55c7... 687f192... M	desktop/core/src/desktop/js/apps/notebook/snippet.js
:100644 100644 238ae90... ecaed4d... M	desktop/libs/notebook/src/notebook/api.py
:100644 100644 5eaea79... b3e7cb9... M	desktop/libs/notebook/src/notebook/connectors/base.py
:100644 100644 254f76b... 9cc9d78... M	desktop/libs/notebook/src/notebook/connectors/jdbc_teradata.py
:100644 100644 773ca55... 3b2ac7f... M	desktop/libs/notebook/src/notebook/connectors/sqlalchemyapi.py
:100644 100644 bba58f4... 752d3d7... M	desktop/libs/notebook/src/notebook/decorators.py
:100644 100644 9991c19... 538fb76... M	desktop/libs/notebook/src/notebook/templates/editor_components.mako

manual

SQL Alchemy offers native connections to databases via dialects https://docs.sqlalchemy.org/en/latest/dialects/.

When the dialect of a paricular datavase is installed on the Hue API server, any of its URL connection strings should work.

e.g.
mysql://root:root@localhost:3306/hue

To offer more self service capabilities, parts of the URL can be parameterized.

Supported parameters are:

  • USER
  • PASSWORD

e.g.
mysql://${USER}:${PASSWORD}@localhost:3306/hue

Parameters are not saved at any time in the Hue database. The are currently not even cached in the Hue process. The clients serves these parameters
each time a query is sent.

Note: the SQL Alchemy engine could leverage create_session() and cache the engine object (without its credentials) like in the jdbc.py interpreter.
Note: this is currently supporting concurrent querying by one users as engine is a new object each time. Could use a thread global SQL Alchemy
session at some point.
Note: using the task server would not leverage any caching.

  • 2
  • 0
  • 0
  • 0
  • 2
Description From Last Updated
I believe with proposed change we can remove this. We should avoid leaky abstractions from lower layers. Jean-Francois Desjeans Gauthier
Some improvements: 1) Move credential handling to create_session 2) Pass the credentials via the properties argument in create_session 3) Save ... Jean-Francois Desjeans Gauthier
  1. 
      
  2. Some improvements:
    1) Move credential handling to create_session
    2) Pass the credentials via the properties argument in create_session
    3) Save all the sessions in a cache like the CONNECTION_CACHE and name it SESSION_CACHE
    4) Rename CONNECTION_CACHE to QUERY_CACHE
    5) Add close_session to handle cleaning up the session in SESSION_CACHE

  3. 
      
  1. 
      
  2. I believe with proposed change we can remove this. We should avoid leaky abstractions from lower layers.

  3. 
      
Review request changed

Status: Closed (submitted)

Loading...