villebro commented on a change in pull request #16449:
URL: https://github.com/apache/superset/pull/16449#discussion_r697190524
##########
File path: superset/views/core.py
##########
@@ -2751,6 +2740,39 @@ def sql_json_exec( # pylint:
disable=too-many-statements,too-many-locals
session, rendered_query, query, expand_data, log_params
)
+ @classmethod
+ def _get_the_query_db(
+ cls, execution_context: SqlJsonExecutionContext, session: Session
+ ) -> Database:
+ mydb = session.query(Database).get(execution_context.database_id)
+ cls._validate_query_db(mydb)
+ return mydb
+
+ @classmethod
+ def _validate_query_db(cls, database: Optional[Database]) -> None:
Review comment:
I would almost move this into `_get_the_query_db`, as this is fairly
simple, not used elsewhere and probably makes `_get_the_query_db` more straight
forward to read wrt. to what it returns vs raises.
--
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]