Эх сурвалжийг харах

HUE-6936 [indexer] Move SQL indexing into its own flag

Romain Rigaux 8 жил өмнө
parent
commit
d77736d

+ 3 - 0
desktop/conf.dist/hue.ini

@@ -682,6 +682,9 @@
   ## Flag to enable the bulk submission of queries as a background task through Oozie.
   # enable_batch_execute=true
 
+  ## Flag to turn on the SQL indexer.
+  # enable_sql_indexer=false
+
   ## Flag to enable the SQL query builder of the table assist.
   # enable_query_builder=true
 

+ 3 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -684,6 +684,9 @@
   ## Flag to enable the bulk submission of queries as a background task through Oozie.
   # enable_batch_execute=false
 
+  ## Flag to turn on the SQL indexer.
+  # enable_sql_indexer=false
+
   ## Flag to enable the SQL query builder of the table assist.
   # enable_query_builder=true
 

+ 4 - 8
desktop/core/src/desktop/templates/common_notebook_ko_components.mako

@@ -21,6 +21,8 @@ from django.utils.translation import ugettext as _
 from desktop import conf
 from desktop.lib.i18n import smart_unicode
 from desktop.views import _ko
+from notebook.conf import ENABLE_SQL_INDEXER
+
 
 LOG = logging.getLogger(__name__)
 
@@ -29,12 +31,6 @@ try:
 except ImportError, e:
   LOG.warn("Hive app is not enabled")
   DOWNLOAD_ROW_LIMIT = None
-
-try:
-  from indexer.conf import ENABLE_NEW_INDEXER
-except ImportError, e:
-  LOG.warn("Indexer app is not enabled")
-  ENABLE_NEW_INDEXER = None
 %>
 
 <%def name="addSnippetMenu()">
@@ -193,7 +189,7 @@ except ImportError, e:
             <i class="fa fa-fw fa-file-excel-o"></i> ${ _('Excel') }
           </a>
         </li>
-        % if hasattr(ENABLE_NEW_INDEXER, 'get') and ENABLE_NEW_INDEXER.get():
+        % if ENABLE_SQL_INDEXER.get():
         <li>
           <a class="download" href="javascript:void(0)" data-bind="click: function() { saveTarget('search-index'); savePath('__hue__'); trySaveResults(); }" title="${ _('Explore result in a dashboard') }">
             <!-- ko template: { name: 'app-icon-template', data: { icon: 'dashboard' } } --><!-- /ko --> ${ _('Dashboard') }
@@ -267,7 +263,7 @@ except ImportError, e:
                 </div>
               </div>
             </div>
-            % if hasattr(ENABLE_NEW_INDEXER, 'get') and ENABLE_NEW_INDEXER.get():
+            % if ENABLE_SQL_INDEXER.get():
             <div class="control-group">
               <div class="controls">
                 <label class="radio">

+ 2 - 1
desktop/libs/indexer/src/indexer/templates/importer.mako

@@ -21,6 +21,7 @@
   from desktop.views import commonheader, commonfooter, commonshare, commonimportexport, _ko
 
   from indexer.conf import ENABLE_NEW_INDEXER, CONFIG_INDEXER_LIBS_PATH
+  from notebook.conf import ENABLE_SQL_INDEXER
 %>
 
 <%namespace name="actionbar" file="actionbar.mako" />
@@ -1045,7 +1046,7 @@ ${ assist.assistPanel() }
       self.inputFormatsAll = ko.observableArray([
           {'value': 'file', 'name': 'File'},
           {'value': 'manual', 'name': 'Manually'},
-          % if ENABLE_NEW_INDEXER.get():
+          % if ENABLE_SQL_INDEXER.get():
           {'value': 'query', 'name': 'SQL Query'},
           {'value': 'table', 'name': 'Table'},
           % endif

+ 6 - 0
desktop/libs/notebook/src/notebook/conf.py

@@ -148,6 +148,12 @@ ENABLE_BATCH_EXECUTE = Config(
   dynamic_default=is_oozie_enabled
 )
 
+ENABLE_SQL_INDEXER = Config(
+  key="enable_sql_indexer",
+  help=_t("Flag to turn on the SQL indexer."),
+  type=bool,
+  default=False
+)
 
 def _default_interpreters(user):
   interpreters = []