Sfoglia il codice sorgente

[editor] Fix getting the session of a Hive query

Romain Rigaux 10 anni fa
parent
commit
0cd45f44d6

+ 2 - 9
desktop/libs/notebook/src/notebook/connectors/hiveserver2.py

@@ -57,18 +57,11 @@ def query_error_handler(func):
 
 class HS2Api(Api):
 
-  SUPPORTED_TYPES = ('hive', 'impala', 'spark-sql')
-
-
   @query_error_handler
   def create_session(self, lang='hive', properties=None):
-    if lang.lower() not in self.SUPPORTED_TYPES:
-      raise PopupException(_('Invalid HS2Api session lang.'))
-
-    if lang == 'hive':
-      lang = 'beeswax'
+    application = 'beeswax' if lang == 'hive' else lang
 
-    session = Session.objects.get_session(self.user, application=lang)
+    session = Session.objects.get_session(self.user, application=application)
 
     if session is None:
       session = dbms.get(self.user, query_server=get_query_server_config(name=lang)).open_session(self.user)