Pārlūkot izejas kodu

HUE-3228 [notebook] Proper dedentation of SQL sample generated code

Romain 6 gadi atpakaļ
vecāks
revīzija
902d9e6d92

+ 3 - 3
desktop/libs/notebook/src/notebook/connectors/sql_alchemy.py

@@ -313,7 +313,7 @@ class SqlAlchemyApi(Api):
 
   @query_error_handler
   def get_browse_query(self, snippet, database, table, partition_spec=None):
-    return '''
+    return textwrap.dedent('''\
       SELECT *
       FROM %(backticks)s%(database)s%(backticks)s.%(backticks)s%(table)s%(backticks)s
       LIMIT 1000
@@ -321,7 +321,7 @@ class SqlAlchemyApi(Api):
         'database': database,
         'table': table,
         'backticks': self.backticks
-    }
+    })
 
 
   def _fix_phoenix_empty_database(self, database):
@@ -352,7 +352,7 @@ class Assist():
 
   def get_sample_data(self, database, table, column=None):
     column = '%(backticks)s%(column)s%(backticks)s' % {'backticks': self.backticks, 'column': column} if column else '*'
-    statement = textwrap.dedent('''
+    statement = textwrap.dedent('''\
       SELECT %(column)s
       FROM %(backticks)s%(database)s%(backticks)s.%(backticks)s%(table)s%(backticks)s
       LIMIT %(limit)s

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

@@ -53,7 +53,8 @@ class TestApi():
 
   def test_fetch_result_empty(self):
     interpreter = {
-      'options': {}
+      'options': {},
+      'url': 'mysql://hue:localhost@hue:3306/hue'
     }
 
     notebook = Mock()