Browse Source

HUE-3450 [editor] Limit popular tables fetching to default DB

Johan Ahlen 9 years ago
parent
commit
e19c74b9bb
1 changed files with 11 additions and 9 deletions
  1. 11 9
      desktop/core/src/desktop/static/desktop/js/sqlAutocompleter.js

+ 11 - 9
desktop/core/src/desktop/static/desktop/js/sqlAutocompleter.js

@@ -45,16 +45,18 @@
         silenceErrors: true,
         successCallback: function () {
           $.each(self.snippet.getAssistHelper().lastKnownDatabases[self.snippet.type()], function (idx, db) {
-            $.post('/metadata/api/optimizer_api/top_tables', {
-              database: db
-            }, function(data){
-              if (! self.topTablesPerDb[db]) {
-                self.topTablesPerDb[db] = {};
-              }
-              data.top_tables.forEach(function (table) {
-                self.topTablesPerDb[db][table.name] = table;
+            if (db === 'default') {
+              $.post('/metadata/api/optimizer_api/top_tables', {
+                database: db
+              }, function(data){
+                if (! self.topTablesPerDb[db]) {
+                  self.topTablesPerDb[db] = {};
+                }
+                data.top_tables.forEach(function (table) {
+                  self.topTablesPerDb[db][table.name] = table;
+                });
               });
-            });
+            }
           });
         }
       });