amitmiran137 commented on a change in pull request #16647:
URL: https://github.com/apache/superset/pull/16647#discussion_r705289051



##########
File path: superset/views/core.py
##########
@@ -2595,33 +2595,9 @@ def _run_sql_json_exec_from_scratch(
             self._get_the_query_db(execution_context, session)
         )
         query = execution_context.create_query()
-        try:
-            session.add(query)
-            session.flush()
-            query_id = query.id
-            session.commit()  # shouldn't be necessary
-        except SQLAlchemyError as ex:
-            logger.error("Errors saving query details %s", str(ex), 
exc_info=True)
-            session.rollback()
-            query_id = None
-        if not query_id:
-            raise SupersetGenericErrorException(
-                __(
-                    "The query record was not created as expected. Please "
-                    "contact an administrator for further assistance or try 
again."
-                )
-            )
-
-        logger.info("Triggering query_id: %i", query_id)
-
-        try:
-            query.raise_for_access()
-        except SupersetSecurityException as ex:
-            query.set_extra_json_key("errors", [dataclasses.asdict(ex.error)])
-            query.status = QueryStatus.FAILED
-            query.error_message = ex.error.message
-            session.commit()
-            raise SupersetErrorException(ex.error, status=403) from ex
+        self._save_new_query(query, session)
+        logger.info("Triggering query_id: %i", query.id)
+        self._validate_authorization(query, session)

Review comment:
       I think it should be validate_access




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