Browse Source

HUE-6108 [editor] Fix sqlite execution and syntax highlighting

Romain Rigaux 8 years ago
parent
commit
ef73341

+ 3 - 4
desktop/libs/notebook/src/notebook/connectors/rdbms.py

@@ -59,8 +59,7 @@ class RdbmsApi(Api):
     table = self._execute(notebook, snippet)
     data = list(table.rows())
     has_result_set = data is not None
-    print table.columns
-    print table.columns_description
+
     return {
       'sync': True,
       'has_result_set': has_result_set,
@@ -69,8 +68,8 @@ class RdbmsApi(Api):
         'has_more': False,
         'data': data if has_result_set else [],
         'meta': [{
-          'name': col['name'],
-          'type': col.get('type', ''),
+          'name': col['name'] if type(col) is dict else col,
+          'type': col.get('type', '') if type(col) is dict else '',
           'comment': ''
         } for col in table.columns_description] if has_result_set else [],
         'type': 'table'

+ 2 - 2
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -336,7 +336,7 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
                 Hive
               <!-- /ko -->
               <!-- ko if: ['impala', 'pig', 'hive', 'beeswax', 'rdbms', 'java', 'spark2', 'sqoop1', 'distcp', 'shell', 'mapreduce'].indexOf(editorType()) == -1 -->
-                <img src="${ static('rdbms/art/icon_rdbms_48.png') }" class="app-icon" alt="${ _('DBQuery icon') }" />
+                <img src="${ static('rdbms/art/icon_rdbms_48.png') }" class="app-icon" alt="${ _('SQL') }" />
                 SQL
               <!-- /ko -->
               </a>
@@ -2819,7 +2819,7 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
         },
         sqlite: {
           placeHolder: '${ _("Example: SELECT * FROM tablename, or press CTRL + space") }',
-          aceMode: 'ace/mode/sqlite',
+          aceMode: 'ace/mode/sql',
           snippetIcon: 'fa-database',
           sqlDialect: true
         },