Browse Source

HUE-8673 [notebook] Flag for the Impala query hints

Not documented for now
Romain Rigaux 7 years ago
parent
commit
33adcc2012

+ 10 - 10
apps/impala/src/impala/conf.py

@@ -118,28 +118,24 @@ SSL = ConfigSection(
       type=coerce_bool,
       default=False
     ),
-
     CACERTS = Config(
       key="cacerts",
       help=_t("Path to Certificate Authority certificates."),
       type=str,
       dynamic_default=default_ssl_cacerts,
     ),
-
     KEY = Config(
       key="key",
       help=_t("Path to the private key file, e.g. /etc/hue/key.pem"),
       type=str,
       default=None
     ),
-
     CERT = Config(
       key="cert",
       help=_t("Path to the public certificate file, e.g. /etc/hue/cert.pem"),
       type=str,
       default=None
     ),
-
     VALIDATE = Config(
       key="validate",
       help=_t("Choose whether Hue should validate certificates received from the server."),
@@ -171,34 +167,38 @@ AUTH_PASSWORD = Config(
   key="auth_password",
   help=_t("LDAP/PAM/.. password of the hue user used for authentications."),
   private=True,
-  dynamic_default=get_auth_password)
+  dynamic_default=get_auth_password
+)
 
 AUTH_PASSWORD_SCRIPT = Config(
   key="auth_password_script",
   help=_t("Execute this script to produce the auth password. This will be used when `auth_password` is not set."),
   private=True,
   type=coerce_password_from_script,
-  default=None)
+  default=None
+)
 
 DAEMON_API_PASSWORD = Config(
   key="daemon_api_password",
   help=_t("Password for Impala Daemon when username/password authentication is enabled for the Impala Daemon UI."),
   private=True,
-  default=None)
+  default=None
+)
 
 DAEMON_API_PASSWORD_SCRIPT = Config(
   key="daemon_api_password_script",
   help=_t("Execute this script to produce the Impala Daemon Password. This will be used when `daemon_api_password` is not set."),
   private=True,
   type=coerce_password_from_script,
-  default=None)
+  default=None
+)
 
 DAEMON_API_USERNAME = Config(
   key="daemon_api_username",
   help=_t("Username for Impala Daemon when username/password authentication is enabled for the Impala Daemon UI."),
   private=True,
-  default=None)
-
+  default=None
+)
 
 
 def config_validator(user):

+ 2 - 1
desktop/libs/metadata/src/metadata/conf.py

@@ -26,6 +26,7 @@ from desktop.lib.conf import Config, ConfigSection, coerce_bool, coerce_password
 from desktop.lib.paths import get_config_root
 
 from metadata.settings import DJANGO_APPS
+from notebook.conf import ENABLE_QUERY_ANALYSIS
 
 
 OPTIMIZER_AUTH_PASSWORD = None
@@ -57,7 +58,7 @@ def has_optimizer():
   return bool(OPTIMIZER.AUTH_KEY_ID.get())
 
 def has_workload_analytics():
-  return bool(ALTUS.AUTH_KEY_ID.get()) and ALTUS.HAS_WA.get()
+  return bool(ALTUS.AUTH_KEY_ID.get()) and ALTUS.HAS_WA.get() or ENABLE_QUERY_ANALYSIS.get()
 
 
 def get_navigator_url():

+ 8 - 4
desktop/libs/notebook/src/notebook/conf.py

@@ -15,10 +15,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-try:
-  from collections import OrderedDict
-except ImportError:
-  from ordereddict import OrderedDict # Python 2.6
+from collections import OrderedDict
 
 from django.utils.translation import ugettext_lazy as _t
 
@@ -173,6 +170,13 @@ ENABLE_PRESENTATION = Config(
   default=True
 )
 
+ENABLE_QUERY_ANALYSIS = Config(
+  key="enable_query_analysis",
+  help=_t("Flag to turn on the built-in hints on Impala queries in the editor."),
+  type=bool,
+  default=False
+)
+
 
 def _default_interpreters(user):
   interpreters = []