浏览代码

[metastore] Show error message when table is created without Sentry privileges

Romain Rigaux 10 年之前
父节点
当前提交
f967ab4
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      apps/beeswax/src/beeswax/create_table.py

+ 6 - 1
apps/beeswax/src/beeswax/create_table.py

@@ -40,11 +40,13 @@ from beeswax.forms import CreateTableForm, ColumnTypeFormSet,\
   PartitionTypeFormSet, CreateByImportFileForm, CreateByImportDelimForm,\
   TERMINATOR_CHOICES
 from beeswax.server import dbms
+from beeswax.server.dbms import QueryServerException
 from beeswax.views import execute_directly
 
 
 LOG = logging.getLogger(__name__)
 
+
 def create_table(request, database='default'):
   """Create a table by specifying its attributes manually"""
   db = dbms.get(request.user)
@@ -244,7 +246,10 @@ def import_wizard(request, database='default'):
 
         do_load_data = s1_file_form.cleaned_data.get('do_import')
         path = s1_file_form.cleaned_data['path']
-        return _submit_create_and_load(request, proposed_query, table_name, path, do_load_data, database=database)
+        try:
+          return _submit_create_and_load(request, proposed_query, table_name, path, do_load_data, database=database)
+        except QueryServerException, e:
+          raise PopupException(_('The table could not be created.'), detail=e.message)
   else:
     s1_file_form = CreateByImportFileForm()