Răsfoiți Sursa

[connectors] Update get_query_server_config signature and snippet wheel

Romain 6 ani în urmă
părinte
comite
92e9fa0d13

+ 1 - 1
apps/beeswax/src/beeswax/server/dbms.py

@@ -65,7 +65,7 @@ def get(user, query_server=None, cluster=None):
   global DBMS_CACHE_LOCK
 
   if query_server is None:
-    query_server = get_query_server_config(cluster=cluster)
+    query_server = get_query_server_config(connector=cluster)
 
   DBMS_CACHE_LOCK.acquire()
   try:

+ 1 - 1
desktop/libs/notebook/src/notebook/conf.py

@@ -94,7 +94,7 @@ def get_ordered_interpreters(user=None):
       "type": i['type'],
       "interface": i['interface'],
       "options": i['options'],
-      'dialect': i.get('dialect', i['name']),
+      'dialect': i.get('dialect', i['name']).lower(),
       'category': i.get('category', 'editor'),
       "is_sql": i.get('is_sql') or i['interface'] in ["hiveserver2", "rdbms", "jdbc", "solr", "sqlalchemy"],
       "is_catalog": i['interface'] in ["hms",],

+ 4 - 0
desktop/libs/notebook/src/notebook/connectors/hiveserver2_tests.py

@@ -30,6 +30,7 @@ from django.urls import reverse
 from TCLIService.ttypes import TStatusCode, TProtocolVersion, TOperationType
 
 from desktop.auth.backend import rewrite_user
+from desktop.conf import has_connectors
 from desktop.lib.i18n import smart_str
 from desktop.lib.django_test_util import make_logged_in_client
 from desktop.lib.test_utils import add_to_group, grant_access
@@ -93,6 +94,9 @@ class TestApi():
     ]
 
   def setUp(self):
+    if not has_connectors():
+      raise SkipTest
+
     self.client = make_logged_in_client(username="test", groupname="default", recreate=True, is_superuser=False)
 
     self.user = rewrite_user(User.objects.get(username="test"))

+ 15 - 12
desktop/libs/notebook/src/notebook/tests.py

@@ -478,31 +478,31 @@ class TestNotebookApiMocked(object):
 def test_get_interpreters_to_show():
   default_interpreters = OrderedDict((
       ('hive', {
-          'name': 'Hive', 'interface': 'hiveserver2', 'type': 'hive', 'is_sql': True, 'options': {}, 'is_catalog': False,
+          'name': 'Hive', 'interface': 'hiveserver2', 'type': 'hive', 'is_sql': True, 'options': {}, 'is_catalog': False, 'category': 'editor', 'dialect': 'hive'
       }),
       ('spark', {
-          'name': 'Scala', 'interface': 'livy', 'type': 'spark', 'is_sql': False, 'options': {}, 'is_catalog': False,
+          'name': 'Scala', 'interface': 'livy', 'type': 'spark', 'is_sql': False, 'options': {}, 'is_catalog': False, 'category': 'editor', 'dialect': 'scala'
       }),
       ('pig', {
-          'name': 'Pig', 'interface': 'pig', 'type': 'pig', 'is_sql': False, 'options': {}, 'is_catalog': False,
+          'name': 'Pig', 'interface': 'pig', 'type': 'pig', 'is_sql': False, 'options': {}, 'is_catalog': False, 'category': 'editor', 'dialect': 'pig'
       }),
       ('java', {
-          'name': 'Java', 'interface': 'oozie', 'type': 'java', 'is_sql': False, 'options': {}, 'is_catalog': False,
+          'name': 'Java', 'interface': 'oozie', 'type': 'java', 'is_sql': False, 'options': {}, 'is_catalog': False, 'category': 'editor', 'dialect': 'java'
       })
     ))
 
   expected_interpreters = OrderedDict((
       ('java', {
-        'name': 'Java', 'interface': 'oozie', 'type': 'java', 'is_sql': False, 'options': {}, 'is_catalog': False,
+        'name': 'Java', 'interface': 'oozie', 'type': 'java', 'is_sql': False, 'options': {}, 'is_catalog': False, 'category': 'editor', 'dialect': 'java'
       }),
       ('pig', {
-        'name': 'Pig', 'interface': 'pig', 'is_sql': False, 'type': 'pig', 'options': {}, 'is_catalog': False,
+        'name': 'Pig', 'interface': 'pig', 'is_sql': False, 'type': 'pig', 'options': {}, 'is_catalog': False, 'category': 'editor', 'dialect': 'pig'
       }),
       ('hive', {
-          'name': 'Hive', 'interface': 'hiveserver2', 'is_sql': True, 'type': 'hive', 'options': {}, 'is_catalog': False,
+          'name': 'Hive', 'interface': 'hiveserver2', 'is_sql': True, 'type': 'hive', 'options': {}, 'is_catalog': False, 'category': 'editor', 'dialect': 'hive'
       }),
       ('spark', {
-          'name': 'Scala', 'interface': 'livy', 'type': 'spark', 'is_sql': False, 'options': {}, 'is_catalog': False,
+          'name': 'Scala', 'interface': 'livy', 'type': 'spark', 'is_sql': False, 'options': {}, 'is_catalog': False, 'category': 'editor', 'dialect': 'scala'
       })
     ))
 
@@ -513,10 +513,13 @@ def test_get_interpreters_to_show():
     appmanager.load_apps(APP_BLACKLIST.get())
 
     interpreters_shown_on_wheel_unset = get_ordered_interpreters()
-    assert_equal(default_interpreters.values(), interpreters_shown_on_wheel_unset,
-                 'get_interpreters_to_show should return the same as get_interpreters when '
-                 'interpreters_shown_on_wheel is unset. expected: %s, actual: %s'
-                 % (default_interpreters.values(), interpreters_shown_on_wheel_unset))
+    assert_equal(
+      default_interpreters.values(),
+      interpreters_shown_on_wheel_unset,
+      'get_interpreters_to_show should return the same as get_interpreters when interpreters_shown_on_wheel is unset. expected: %s, actual: %s' % (
+          default_interpreters.values(), interpreters_shown_on_wheel_unset
+      )
+    )
 
     resets.append(INTERPRETERS_SHOWN_ON_WHEEL.set_for_testing('java,pig'))
     assert_equal(expected_interpreters.values(), get_ordered_interpreters(),