john-bodley commented on code in PR #20729:
URL: https://github.com/apache/superset/pull/20729#discussion_r939048444


##########
superset/db_engine_specs/presto.py:
##########
@@ -947,20 +961,16 @@ def get_create_view(
         :param schema: Schema name
         :param table: Table (view) name
         """
-        # pylint: disable=import-outside-toplevel
-        from pyhive.exc import DatabaseError
 
         engine = cls.get_engine(database, schema)
         with closing(engine.raw_connection()) as conn:
             cursor = conn.cursor()
             sql = f"SHOW CREATE VIEW {schema}.{table}"
             try:
                 cls.execute(cursor, sql)
-
-            except DatabaseError:  # not a VIEW
+                return cls.fetch_data(cursor, 1)[0][0]
+            except SupersetDBAPIDatabaseError:   # not a VIEW

Review Comment:
   Sadly because we're using a raw connection, i.e., outside of the SQLAlchemy 
realm, the error comes from the underlying DBAPI, i.e., it's wrapped by 
SQLAlchemy, and thus we need to define the `get_dbapi_exception_mapping` 
mapping. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to