betodealmeida commented on a change in pull request #15403:
URL: https://github.com/apache/superset/pull/15403#discussion_r666987708
##########
File path: superset-frontend/src/SqlLab/components/SqlEditor.jsx
##########
@@ -242,6 +245,13 @@ class SqlEditor extends React.PureComponent {
}
}
+ onBeforeUnload(event) {
+ if (this.props.latestQuery?.state === 'running') {
+ event.preventDefault();
+ this.stopQuery();
Review comment:
One more question about this: can we make sure that we stop only queries
when the DB is in sync mode? if the DB is in async mode the expectation I don't
think we should ever cancel the query by navigating away from the browser.
##########
File path: superset/sql_lab.py
##########
@@ -288,6 +293,12 @@ def execute_sql_statement(
)
)
except Exception as ex:
+ # query is stopped in another thread/worker
+ # stopping rases expected exceptions which we should skip
Review comment:
```suggestion
# stopping raises expected exceptions which we should skip
```
##########
File path: superset/db_engine_specs/base.py
##########
@@ -1304,6 +1304,30 @@ def get_column_spec(
)
return None
+ @classmethod
+ def get_cancel_query_id(cls, cursor: Any, query: Query) -> Optional[str]:
+ """
+ Select identifiers from the database engine that uniquely identifies
the
+ queries to cancel. The identifier is typically a session id, process id
+ or similar.
+
+ :param cursor: Cursor instance in which the query will be executed
+ :param query: Query instance
+ :return: Query identifier
+ """
+ return None
+
+ @classmethod
+ def cancel_query(cls, cursor: Any, query: Query, cancel_query_id: str) ->
None:
Review comment:
Is it possible to return a boolean indicating if the query was canceled?
--
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]