Sfoglia il codice sorgente

CDPD-15032 [metastore] Drop selected Databases errors

agl29 5 anni fa
parent
commit
e80a41bb43

+ 3 - 3
apps/metastore/src/metastore/tests.py

@@ -291,7 +291,7 @@ class TestMetastoreWithHadoop(BeeswaxSampleProvider):
     # Drop them
     resp = self.client.get('/metastore/tables/drop/%s' % self.db_name, follow=True)
     assert_true('want to delete' in resp.content, resp.content)
-    resp = self.client.post('/metastore/tables/drop/%s' % self.db_name, {u'table_selection': [u'test_drop_1', u'test_drop_2', u'test_drop_3']})
+    resp = self.client.post('/metastore/tables/drop/%s' % self.db_name, {u'table_selection': [u'test_drop_1', u'test_drop_2', u'test_drop_3'], 'is_embeddable': True})
     assert_equal(resp.status_code, 302)
 
   def test_drop_multi_tables_with_skip_trash(self):
@@ -306,7 +306,7 @@ class TestMetastoreWithHadoop(BeeswaxSampleProvider):
     # Drop them
     resp = self.client.get('/metastore/tables/drop/%s' % self.db_name, follow=True)
     assert_true('want to delete' in resp.content, resp.content)
-    resp = self.client.post('/metastore/tables/drop/%s' % self.db_name, {u'table_selection': [u'test_drop_multi_tables_with_skip_trash_1', u'test_drop_multi_tables_with_skip_trash_2', u'test_drop_multi_tables_with_skip_trash_3'], u'skip_trash': u'on'})
+    resp = self.client.post('/metastore/tables/drop/%s' % self.db_name, {u'table_selection': [u'test_drop_multi_tables_with_skip_trash_1', u'test_drop_multi_tables_with_skip_trash_2', u'test_drop_multi_tables_with_skip_trash_3'], u'skip_trash': u'on', 'is_embeddable': True})
     assert_equal(resp.status_code, 302)
 
     response = self.client.get("/metastore/tables/%s?format=json" % self.db_name)
@@ -339,7 +339,7 @@ class TestMetastoreWithHadoop(BeeswaxSampleProvider):
       # Drop them
       resp = self.client.get('/metastore/databases/drop', follow=True)
       assert_true('want to delete' in resp.content, resp.content)
-      resp = self.client.post('/metastore/databases/drop', {u'database_selection': [db1, db2, db3]})
+      resp = self.client.post('/metastore/databases/drop', {u'database_selection': [db1, db2, db3], 'is_embeddable': True})
       assert_equal(resp.status_code, 302)
     finally:
       make_query(self.client, 'DROP DATABASE IF EXISTS %(db)s' % {'db': db1}, wait=True)

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

@@ -111,7 +111,7 @@ def drop_database(request):
     try:
       if request.POST.get('is_embeddable'):
         design = SavedQuery.create_empty(app_name=source_type if source_type != 'hive' else 'beeswax', owner=request.user, data=hql_query('').dumps())
-        last_executed = json.loads(request.POST.get('start_time'), '-1')
+        last_executed = json.loads(request.POST.get('start_time', '-1'))
         cluster = json.loads(request.POST.get('cluster', '{}'))
         namespace = json.loads(request.POST.get('namespace', '{}'))
         sql = db.drop_databases(databases, design, generate_ddl_only=True)
@@ -448,7 +448,7 @@ def drop_table(request, database):
       namespace = json.loads(request.POST.get('namespace', '{}'))
 
       if request.POST.get('is_embeddable'):
-        last_executed = json.loads(request.POST.get('start_time'), '-1')
+        last_executed = json.loads(request.POST.get('start_time', '-1'))
         sql = db.drop_tables(database, tables_objects, design=None, skip_trash=skip_trash, generate_ddl_only=True)
         job = make_notebook(
             name=_('Drop table %s') % ', '.join([table.name for table in tables_objects])[:100],