Browse Source

HUE-8330 [cluster] Support sending a remot autocomplete call

$.post("/notebook/api/autocomplete/default", {
        "snippet": ko.mapping.toJSON({"type":"impala","source":"data"}),
        "cluster": ko.mapping.toJSON("crn:altus:analyticdb:us-west-1:9d74eee4-1cad-45d7-b645-7ccf9edbb73d:cluster:arcus-ganeshk/1dbcb210-f113-4a59-aa68-61848092c074")
      }, function(data) {
        console.log(ko.mapping.toJSON(data));
      });
Romain Rigaux 7 years ago
parent
commit
a9c5abe33f
1 changed files with 6 additions and 3 deletions
  1. 6 3
      desktop/libs/notebook/src/notebook/connectors/altus_adb.py

+ 6 - 3
desktop/libs/notebook/src/notebook/connectors/altus_adb.py

@@ -16,6 +16,7 @@
 # limitations under the License.
 # limitations under the License.
 
 
 import logging
 import logging
+import json
 import re
 import re
 import urllib
 import urllib
 
 
@@ -130,7 +131,7 @@ class AltusAdbApi(Api):
     if nested is not None:
     if nested is not None:
       url_path = '%s/%s' % (url_path, nested)
       url_path = '%s/%s' % (url_path, nested)
 
 
-    return HueQuery(self.user, cluster_crn=self.cluster_name).do_post(url_path=url_path)['payload']
+    return HueQuery(self.user, cluster_crn=self.cluster_name).do_post(url_path=url_path)
 
 
 
 
 class HueQuery():
 class HueQuery():
@@ -151,7 +152,8 @@ class HueQuery():
         ]
         ]
       }}''' 
       }}''' 
     
     
-    return self.api.submit_hue_query(self.cluster_crn, payload)
+    resp = self.api.submit_hue_query(self.cluster_crn, payload)
+    return json.loads(resp['payload'])
 
 
   def do_execute(self, query):
   def do_execute(self, query):
     payload = r'''
     payload = r'''
@@ -204,7 +206,8 @@ class HueQuery():
             
             
     payload = payload.replace('SELECT+*+FROM+web_logs+LIMIT+100', urllib.quote_plus(query))
     payload = payload.replace('SELECT+*+FROM+web_logs+LIMIT+100', urllib.quote_plus(query))
     
     
-    return self.api.submit_hue_query(self.cluster_crn, payload)
+    resp = self.api.submit_hue_query(self.cluster_crn, payload)
+    return json.loads(resp['payload'])
 
 
   # check_status
   # check_status