Forráskód Böngészése

[sparksql] Strip semi colon automatically via sqlalchemy to avoid error

Romain Rigaux 5 éve
szülő
commit
31a591b1f8

+ 1 - 1
desktop/core/src/desktop/lib/connectors/types.py

@@ -221,7 +221,7 @@ CONNECTOR_TYPES = [
       'has_reference_language': False,
       'has_reference_functions': False,
       'has_use_statement': False,
-      'trim_statement_semicolon': False,
+      'trim_statement_semicolon': True,
     }
   },
   {

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

@@ -223,8 +223,7 @@ class SqlAlchemyApi(Api):
     connection = engine.connect()
     statement = snippet['statement']
 
-    if self.options['url'].startswith('phoenix://') or self.options['url'].startswith('presto://') or \
-        self.interpreter['dialect_properties'].get('trim_statement_semicolon'):
+    if self.interpreter['dialect_properties'].get('trim_statement_semicolon', True):
       statement = statement.strip().rstrip(';')
 
     if self.interpreter['dialect_properties'].get('has_use_statement') and snippet.get('database'):

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

@@ -278,6 +278,8 @@ class TestApi(object):
 
         # No Trim
         interpreter['options']['url'] = 'mysql://hue:3306/hue'
+        interpreter['dialect_properties']['trim_statement_semicolon'] = False
+        interpreter['dialect_properties']['sql_identifier_quote'] = '`'
 
         engine = SqlAlchemyApi(self.user, interpreter).execute(notebook, snippet)