You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2022/10/12 17:05:16 UTC

[superset] 01/01: move logs to commands.py

This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch mv-sql-error-logs
in repository https://gitbox.apache.org/repos/asf/superset.git

commit da51786f4e33fb3af9564e75a3d88d4a8988667c
Author: hughhhh <hu...@gmail.com>
AuthorDate: Wed Oct 12 13:04:56 2022 -0400

    move logs to commands.py
---
 superset/sql_lab.py        | 2 --
 superset/sqllab/command.py | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/superset/sql_lab.py b/superset/sql_lab.py
index ea91133270..5c52dc8b4c 100644
--- a/superset/sql_lab.py
+++ b/superset/sql_lab.py
@@ -313,8 +313,6 @@ def execute_sql_statement(  # pylint: disable=too-many-arguments,too-many-statem
         if query.status == QueryStatus.STOPPED:
             raise SqlLabQueryStoppedException() from ex
 
-        logger.error("Query %d: %s", query.id, type(ex), exc_info=True)
-        logger.debug("Query %d: %s", query.id, ex)
         raise SqlLabException(db_engine_spec.extract_error_message(ex)) from ex
 
     logger.debug("Query %d: Fetching cursor description", query.id)
diff --git a/superset/sqllab/command.py b/superset/sqllab/command.py
index 0aeab754ca..1fcbee3671 100644
--- a/superset/sqllab/command.py
+++ b/superset/sqllab/command.py
@@ -132,6 +132,8 @@ class ExecuteSqlCommand(BaseCommand):
                 ) from ex
             raise ex
         except Exception as ex:
+            logger.error("Query %d: %s", query.id, type(ex), exc_info=True)
+            logger.debug("Query %d: %s", query.id, ex)
             raise SqlLabException(self._execution_context, exception=ex) from ex
 
     def _try_get_existing_query(self) -> Optional[Query]: