Преглед изворни кода

HUE-1189 [beeswax] Autocomplete failure should not 500 the page

Fix tests
Romain Rigaux пре 12 година
родитељ
комит
0da9f01

+ 1 - 1
apps/beeswax/src/beeswax/templates/execute.mako

@@ -703,7 +703,7 @@ ${layout.menubar(section='query')}
         lineNumbers: true,
         mode: "text/x-hiveql",
         extraKeys: {
-          "Shift-Space": function () {
+          "Ctrl-Space": function () {
             CodeMirror.fromDot = false;
             codeMirror.execCommand("autocomplete");
           },

+ 9 - 5
apps/beeswax/src/beeswax/views.py

@@ -336,16 +336,20 @@ def execute_query(request, design_id=None):
   dbs = db.get_databases()
   databases = ((db, db) for db in dbs)
 
+  # Todo: build lazily
   autocomplete = {}
   for database in dbs:
     tables = db.get_tables(database=database)
     autocomplete_tables = []
     for table in tables:
-      t = db.get_table(database, table)
-      autocomplete_tables.append({
-        'name': t.name,
-        'cols': [column.name for column in t.cols]
-      })
+      try:
+        t = db.get_table(database, table)
+        autocomplete_tables.append({
+          'name': t.name,
+          'cols': [column.name for column in t.cols]
+        })
+      except Exception, e:
+        LOG.warn('Skipping table %s.%s : %s' % (database, table, e))
 
     autocomplete[database] = {
       'tables': autocomplete_tables

+ 3 - 0
apps/impala/src/impala/tests.py

@@ -29,6 +29,9 @@ class MockDbms:
   def get_databases(self):
     return ['db1', 'db2']
 
+  def get_tables(self, database):
+    return ['table1', 'table2']
+
 
 class TestImpala:
   def setUp(self):