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 2019/05/17 19:25:57 UTC

[GitHub] [incubator-superset] john-bodley commented on a change in pull request #7504: Add try/catch to cursor.fetchall()

john-bodley commented on a change in pull request #7504: Add try/catch to cursor.fetchall()
URL: https://github.com/apache/incubator-superset/pull/7504#discussion_r285259404
 
 

 ##########
 File path: superset/models/core.py
 ##########
 @@ -866,7 +866,10 @@ def _log_query(sql):
                 for sql in sqls[:-1]:
                     _log_query(sql)
                     self.db_engine_spec.execute(cursor, sql)
-                    cursor.fetchall()
+                    try:
+                        cursor.fetchall()
+                    except BaseException:
+                        pass
 
 Review comment:
   It seems like the raw connection exposes the underlying DB-API. Per [PEP 249](https://www.python.org/dev/peps/pep-0249/) the `fetchall` method raises an [`Error`](https://www.python.org/dev/peps/pep-0249/#error) and thus sense we should use the SQLAlchemy equivalent exception here rather than `BaseException`.

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