def post_expand_filter_query(filter_definition): try: matched = BaseHandler(job_id=None).expand_filter_query(filter_definition) except Exception as exc: logger.exception(str(exc)) return {"error": str(exc), "traceback": traceback.format_exc()}, 401 return {"matched": matched}, 200
def post_show_select_query(filter_definition): try: query = BaseHandler(job_id=None).construct_select_query(filter_definition.pop(BaseHandler.DEFAULT_FILTER_KEY)) except Exception as exc: logger.exception(str(exc)) return {"error": str(exc), "traceback": traceback.format_exc()}, 401 return {"query": query}, 200
def post_expand_filter_query(filter_definition): """Use filter to query database and show results that matched given filter.""" try: matched = BaseHandler( job_id=None).expand_filter_query(filter_definition) except Exception as exc: logger.exception(str(exc)) return {"error": str(exc), "traceback": traceback.format_exc()}, 400 return {"matched": matched}, 200
def post_show_select_query(filter_definition): """Show SQL query that will be used in case of filter parametrized jobs.""" try: query = BaseHandler(job_id=None).construct_select_query( filter_definition.pop(BaseHandler.DEFAULT_FILTER_KEY)) except Exception as exc: logger.exception(str(exc)) return {"error": str(exc), "traceback": traceback.format_exc()}, 400 return {"query": query}, 200