xtinec commented on a change in pull request #6220: [SIP-5] Open a new /api/v1/query endpoint that takes query_obj URL: https://github.com/apache/incubator-superset/pull/6220#discussion_r231335638
########## File path: superset/common/query_context.py ########## @@ -0,0 +1,24 @@ +# pylint: disable=R +from typing import Dict + +from superset import db +from superset.connectors.connector_registry import ConnectorRegistry +from .query_object import QueryObject + + +class QueryContext: + """ + The query context contains the query object and additional fields necessary + to retrieve the data payload for a given viz. + """ + # TODO: Type datasource and query_object dictionary with TypedDict when it becomes + # a vanilla python type https://github.com/python/mypy/issues/5288 + def __init__( + self, + datasource: Dict, + query_object: Dict, + ): + self.datasource = ConnectorRegistry.get_datasource(datasource.get('type'), + datasource.get('id'), + db.session) + self.query_object = QueryObject(**query_object) Review comment: Yep, I can change this to an array of `QueryObject`s. Good callout! ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
