From 131308c730c42b2c6ba34a6dd16d04e801dec011 Mon Sep 17 00:00:00 2001 From: hughhhh Date: Wed, 12 Oct 2022 17:10:30 -0400 Subject: [PATCH] fix pre-commit --- superset/sqllab/command.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/superset/sqllab/command.py b/superset/sqllab/command.py index d727ea6d207de..613edf8d69859 100644 --- a/superset/sqllab/command.py +++ b/superset/sqllab/command.py @@ -132,7 +132,8 @@ def run( # pylint: disable=too-many-statements,useless-suppression ) from ex raise ex except Exception as ex: - logger.exception("Query %d: %s", query.id, type(ex)) + query_id = query.id if query else None + logger.exception("Query %d: %s", query_id, type(ex)) raise SqlLabException(self._execution_context, exception=ex) from ex def _try_get_existing_query(self) -> Optional[Query]: