You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ta...@apache.org on 2020/06/16 19:59:03 UTC
[incubator-superset] branch master updated: fix: use custom int
parsing over flask int parsing in sqllab queries endpoint (#10070)
This is an automated email from the ASF dual-hosted git repository.
tai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 2612046 fix: use custom int parsing over flask int parsing in sqllab queries endpoint (#10070)
2612046 is described below
commit 26120467af3825577a30190f42d942836b147c9f
Author: ʈᵃᵢ <td...@gmail.com>
AuthorDate: Tue Jun 16 12:58:32 2020 -0700
fix: use custom int parsing over flask int parsing in sqllab queries endpoint (#10070)
---
superset/views/core.py | 7 ++++---
tests/sqllab_tests.py | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/superset/views/core.py b/superset/views/core.py
index fc14d36..e173972 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -2658,14 +2658,15 @@ class Superset(BaseSupersetView):
return json_success(json.dumps(datasource.data))
@has_access_api
- @expose("/queries/<int:last_updated_ms>")
- def queries(self, last_updated_ms: int) -> FlaskResponse:
+ @expose("/queries/<last_updated_ms>")
+ def queries(self, last_updated_ms: str) -> FlaskResponse:
"""
Get the updated queries.
:param last_updated_ms: unix time, milliseconds
"""
- return self.queries_exec(last_updated_ms)
+ last_updated_ms_int = int(float(last_updated_ms)) if last_updated_ms else 0
+ return self.queries_exec(last_updated_ms_int)
def queries_exec(self, last_updated_ms: int) -> FlaskResponse:
stats_logger.incr("queries")
diff --git a/tests/sqllab_tests.py b/tests/sqllab_tests.py
index 6f08f0d..e88c1b0 100644
--- a/tests/sqllab_tests.py
+++ b/tests/sqllab_tests.py
@@ -210,7 +210,7 @@ class SqlLabTests(SupersetTestCase):
db.session.commit()
data = self.get_json_resp(
- "/superset/queries/{}".format(int(datetime_to_epoch(now)) - 1000)
+ "/superset/queries/{}".format(float(datetime_to_epoch(now)) - 1000)
)
self.assertEqual(1, len(data))