浏览代码

HUE-8610 [tb] Post the source type when calling describe table

Johan Ahlen 7 年之前
父节点
当前提交
93029bac29
共有 2 个文件被更改,包括 6 次插入5 次删除
  1. 2 2
      apps/metastore/src/metastore/views.py
  2. 4 3
      desktop/core/src/desktop/static/desktop/js/apiHelper.js

+ 2 - 2
apps/metastore/src/metastore/views.py

@@ -297,8 +297,8 @@ def get_table_metadata(request, database, table):
 def describe_table(request, database, table):
   app_name = get_app_name(request)
   cluster = json.loads(request.POST.get('cluster', '{}'))
-
-  db = _get_db(user=request.user, cluster=cluster)
+  source_type = request.POST.get('source_type')
+  db = _get_db(user=request.user, source_type=source_type, cluster=cluster)
 
   try:
     table = db.get_table(database, table)

+ 4 - 3
desktop/core/src/desktop/static/desktop/js/apiHelper.js

@@ -1395,6 +1395,7 @@ var ApiHelper = (function () {
    * @param {boolean} [options.silenceErrors]
    *
    * @param {ContextCompute} options.compute
+   * @param {string} options.sourceType
    * @param {string[]} options.path
    *
    * @return {CancellablePromise}
@@ -1421,11 +1422,11 @@ var ApiHelper = (function () {
 
     var data = {
       format: 'json',
-      cluster: JSON.stringify(options.compute)
-      //'source_type': options.sourceType // TODO: Blows up server-side with 'impala'
+      cluster: JSON.stringify(options.compute),
+      source_type: options.sourceType
     };
 
-    var request = self[options.path.length === 1 ? 'simplePost' : 'simpleGet'](url, data, {
+    var request = self[options.path.length < 3 ? 'simplePost' : 'simpleGet'](url, data, {
       silenceErrors: options.silenceErrors,
       successCallback: function (response) {
         if (options.path.length === 1) {