-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Cassandra] Fix: cassandra.cluster.Error wasn't imported #1423
Conversation
from redash.utils import JSONEncoder | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
try: | ||
from cassandra.cluster import Cluster | ||
from cassandra.cluster import Cluster, Error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not fully sure if this Error
import works well. At least when I tested, it did not work and I have to remove it and replace the reference below by ValueError
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by works well? It wasn't found?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in log file found this trace [2016-11-23 09:44:06,140][PID:18841][WARNING][redash.query_runner] Cassandra query runner enabled but not supported, not registering. Either disable or install missing dependencies.
which causes it is import error:
python -c "from cassandra.cluster import Cluster, Error"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name Error
python --version
Python 2.7.6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right there is no such thing. I just assumed it exists as it was referenced in the code...
@@ -86,22 +85,22 @@ def run_query(self, query, user): | |||
json_data = json.dumps(data, cls=JSONEncoder) | |||
|
|||
error = None | |||
|
|||
except cassandra.cluster.Error, e: | |||
except Error as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as commented above I change it for ValueError
Hi @arikfr |
Fixes #1422.