You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/07/27 15:31:39 UTC

[GitHub] mistercrunch closed pull request #5502: Improve hive/pyhive error message regex

mistercrunch closed pull request #5502: Improve hive/pyhive error message regex
URL: https://github.com/apache/incubator-superset/pull/5502
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index 5e5a30414a..ebc8802668 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -1052,7 +1052,7 @@ def adjust_database_uri(cls, uri, selected_schema=None):
     @classmethod
     def extract_error_message(cls, e):
         msg = str(e)
-        match = re.search('errorMessage="(.*)", ', msg)
+        match = re.search(r'errorMessage="(.*?)(?<!\\)"', msg)
         if match:
             msg = match.group(1)
         return msg
diff --git a/tests/db_engine_specs_test.py b/tests/db_engine_specs_test.py
index 287114ccd7..1b340b4dcd 100644
--- a/tests/db_engine_specs_test.py
+++ b/tests/db_engine_specs_test.py
@@ -103,6 +103,15 @@ def test_hive_error_msg(self):
             text_type(e),
             HiveEngineSpec.extract_error_message(e))
 
+        msg = (
+            'errorCode=10001, '
+            'errorMessage="Error while compiling statement"), operationHandle'
+            '=None)"'
+        )
+        self.assertEquals((
+            'Error while compiling statement'),
+            HiveEngineSpec.extract_error_message(Exception(msg)))
+
     def get_generic_database(self):
         return Database(sqlalchemy_uri='mysql://localhost')
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org