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


##########
superset/db_engine_specs/presto.py:
##########
@@ -957,8 +963,23 @@ def get_create_view(
         return rows[0][0]
 
     @classmethod
-    def handle_cursor(cls, cursor: Any, query: Query, session: Session) -> 
None:
+    def get_tracking_url(cls, cursor: "Cursor") -> Optional[str]:
+        try:
+            if cursor.last_query_id:
+                # pylint: disable=protected-access, line-too-long
+                return 
f"{cursor._protocol}://{cursor._host}:{cursor._port}/ui/query.html?{cursor.last_query_id}"
+        except AttributeError:
+            pass
+        return None

Review Comment:
   ```suggestion
   ```



##########
superset/db_engine_specs/presto.py:
##########
@@ -957,8 +963,23 @@ def get_create_view(
         return rows[0][0]
 
     @classmethod
-    def handle_cursor(cls, cursor: Any, query: Query, session: Session) -> 
None:
+    def get_tracking_url(cls, cursor: "Cursor") -> Optional[str]:
+        try:
+            if cursor.last_query_id:
+                # pylint: disable=protected-access, line-too-long
+                return 
f"{cursor._protocol}://{cursor._host}:{cursor._port}/ui/query.html?{cursor.last_query_id}"
+        except AttributeError:
+            pass

Review Comment:
   ```suggestion
               return None
   ```



##########
superset/db_engine_specs/hive.py:
##########
@@ -366,21 +366,14 @@ def handle_cursor(  # pylint: disable=too-many-locals
                     query.progress = progress
                     needs_commit = True
                 if not tracking_url:
-                    tracking_url = cls.get_tracking_url(log_lines)
+                    tracking_url = cls.get_tracking_url_from_logs(log_lines)
                     if tracking_url:
                         job_id = tracking_url.split("/")[-2]
                         logger.info(
                             "Query %s: Found the tracking url: %s",
                             str(query_id),
                             tracking_url,
                         )
-                        transformer = 
current_app.config["TRACKING_URL_TRANSFORMER"]

Review Comment:
   @ktmud per you PR description this logic has changed. Can we confirmed that 
the previous behavior is preserved? I just want to confirm this isn't a 
breaking change.



##########
superset/db_engine_specs/trino.py:
##########
@@ -109,8 +114,25 @@ def get_view_names(
         )
 
     @classmethod
-    def handle_cursor(cls, cursor: Any, query: Query, session: Session) -> 
None:
+    def get_tracking_url(cls, cursor: "Cursor") -> Optional[str]:
+        try:
+            return cursor.info_uri
+        except AttributeError:
+            try:
+                conn = cursor.connection
+                # pylint: disable=protected-access, line-too-long
+                return 
f"{conn.http_scheme}://{conn.host}:{conn.port}/ui/query.html?{cursor._query.query_id}"
+            except AttributeError:
+                pass

Review Comment:
   See previous comment.



-- 
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