From fe6ea5901bf0a77cde50c5a5bb223b634176458c Mon Sep 17 00:00:00 2001 From: Sheng Hong Tan Date: Thu, 11 Oct 2018 22:15:29 -0700 Subject: [PATCH] expose queries endpoint (cherry picked from commit d23bfa0477e6782cc78326cea4a83b600106b385) (cherry picked from commit 7fdd3e8d44e7129e256e16c58c5a0d5a5348044f) (cherry picked from commit 914029db6c5697fd2ddc908e7701734a49924727) (cherry picked from commit 0c35cd9864b3187fed0ad1457058cdbb87a50c90) --- superset/views/core.py | 3 +++ superset/views/lyft.py | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/superset/views/core.py b/superset/views/core.py index aca096a4fe1e5..b40a98b7e8792 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -2657,6 +2657,9 @@ def fetch_datasource_metadata(self): @has_access_api @expose('/queries/') def queries(self, last_updated_ms): + return self.queries_call(last_updated_ms) + + def queries_call(self, last_updated_ms): """Get the updated queries.""" stats_logger.incr('queries') if not g.user.get_id(): diff --git a/superset/views/lyft.py b/superset/views/lyft.py index a9b5171e007b2..35775b4f800a0 100644 --- a/superset/views/lyft.py +++ b/superset/views/lyft.py @@ -70,5 +70,15 @@ def sql_json(self): return json_error_response('{}'.format(e)) return self.sql_json_call(request) + @has_access_api + @expose('/queries/') + @log_this + def queries(self, last_updated_ms): + try: + self.authorize() + except (UserDontExistException, SupersetException) as e: + return json_error_response('{}'.format(e)) + return self.queries_call(last_updated_ms) + appbuilder.add_view_no_menu(Lyft)