Explorar o código

HUE-9441 [editor] Switch to empty string when there's no database name for Phoenix

Johan Ahlen %!s(int64=5) %!d(string=hai) anos
pai
achega
557d631355

+ 1 - 8
desktop/libs/notebook/src/notebook/connectors/sql_alchemy.py

@@ -341,15 +341,12 @@ class SqlAlchemyApi(Api):
     assist = Assist(inspector, engine, backticks=self.backticks)
     assist = Assist(inspector, engine, backticks=self.backticks)
     response = {'status': -1}
     response = {'status': -1}
 
 
-    if database is not None:
-      database = self._fix_phoenix_empty_database(database)
-
     if operation == 'functions':
     if operation == 'functions':
       response['functions'] = []
       response['functions'] = []
     elif operation == 'function':
     elif operation == 'function':
       response['function'] = {}
       response['function'] = {}
     elif database is None:
     elif database is None:
-      response['databases'] = [db or ' ' for db in assist.get_databases()]
+      response['databases'] = [db or '' for db in assist.get_databases()]
     elif table is None:
     elif table is None:
       tables_meta = []
       tables_meta = []
       for t in assist.get_tables(database):
       for t in assist.get_tables(database):
@@ -433,10 +430,6 @@ class SqlAlchemyApi(Api):
     return name
     return name
 
 
 
 
-  def _fix_phoenix_empty_database(self, database):
-    return '' if self.options['url'].startswith('phoenix://') and database == ' ' else database
-
-
   def _fix_bigquery_db_prefixes(self, table_or_column):
   def _fix_bigquery_db_prefixes(self, table_or_column):
     if self.options['url'].startswith('bigquery://'):
     if self.options['url'].startswith('bigquery://'):
       table_or_column = table_or_column.rsplit('.', 1)[-1]
       table_or_column = table_or_column.rsplit('.', 1)[-1]

+ 1 - 1
desktop/libs/notebook/src/notebook/connectors/sql_alchemy_tests.py

@@ -336,7 +336,7 @@ class TestAutocomplete(object):
 
 
           data = SqlAlchemyApi(self.user, interpreter).autocomplete(snippet)
           data = SqlAlchemyApi(self.user, interpreter).autocomplete(snippet)
 
 
-          assert_equal(data['databases'], ['SYSTEM', ' '])
+          assert_equal(data['databases'], ['SYSTEM', ''])
 
 
   def test_columns_with_null_type(self):
   def test_columns_with_null_type(self):
     interpreter = {
     interpreter = {