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_r231313218
########## File path: superset/common/query_object.py ########## @@ -0,0 +1,59 @@ +# pylint: disable=R +from typing import Dict, List, Optional, Union + +from superset import app +from superset.utils import core as utils + +# TODO: Type Metrics dictionary with TypedDict when it becomes a vanilla python type +# https://github.com/python/mypy/issues/5288 +Metric = Union[str, Dict] + + +class QueryObject: + """ + The query object's schema matches the interfaces of DB connectors like sqla + and druid. The query objects are constructed on the client. + """ + def __init__( + self, + granularity: str, + groupby: List[str], + metrics: List[Metric], + filters: List[str], + time_range: Optional[str] = None, Review comment: Good question! I agree we should only have one. Looking at the code, seems like the calculation based on `time_range` encompass the one based on `since` and `until`. I'll have the new `query_object` only take `time_range`. 😄 ---------------------------------------------------------------- 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]
