From f3f39a5b00f88bfe8e23b1cd27f348811071027c Mon Sep 17 00:00:00 2001 From: syerushalmy Date: Mon, 19 Dec 2016 21:35:36 +0200 Subject: [PATCH 1/2] Changed exception type to ReadTimeout and added test query for test connection --- redash/query_runner/cass.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/redash/query_runner/cass.py b/redash/query_runner/cass.py index f00bff92..70b1df4d 100644 --- a/redash/query_runner/cass.py +++ b/redash/query_runner/cass.py @@ -9,13 +9,14 @@ logger = logging.getLogger(__name__) try: from cassandra.cluster import Cluster from cassandra.auth import PlainTextAuthProvider + from cassandra import ReadTimeout enabled = True except ImportError: enabled = False class Cassandra(BaseQueryRunner): - noop_query = "SELECT * FROM system" + noop_query = "SELECT * FROM system.compactions_in_progress" @classmethod def enabled(cls): @@ -85,6 +86,9 @@ class Cassandra(BaseQueryRunner): json_data = json.dumps(data, cls=JSONEncoder) error = None + except ReadTimeout as e: + error = e + json_data = None except KeyboardInterrupt: error = "Query cancelled by user." json_data = None From a860c83963ad6a9c7abb04a753065d0925cc461e Mon Sep 17 00:00:00 2001 From: syerushalmy Date: Tue, 20 Dec 2016 11:46:58 +0200 Subject: [PATCH 2/2] Removed ReadTimeout exception --- redash/query_runner/cass.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/redash/query_runner/cass.py b/redash/query_runner/cass.py index 70b1df4d..08f9ce55 100644 --- a/redash/query_runner/cass.py +++ b/redash/query_runner/cass.py @@ -9,7 +9,6 @@ logger = logging.getLogger(__name__) try: from cassandra.cluster import Cluster from cassandra.auth import PlainTextAuthProvider - from cassandra import ReadTimeout enabled = True except ImportError: enabled = False @@ -86,9 +85,6 @@ class Cassandra(BaseQueryRunner): json_data = json.dumps(data, cls=JSONEncoder) error = None - except ReadTimeout as e: - error = e - json_data = None except KeyboardInterrupt: error = "Query cancelled by user." json_data = None