Skip to content
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

Merged
merged 1 commit into from
Nov 23, 2016
Merged

Conversation

arikfr
Copy link
Member

@arikfr arikfr commented Nov 23, 2016

Fixes #1422.

@arikfr arikfr merged commit 0947491 into master Nov 23, 2016
@arikfr arikfr deleted the cass_error branch November 23, 2016 08:53
from redash.utils import JSONEncoder

logger = logging.getLogger(__name__)

try:
from cassandra.cluster import Cluster
from cassandra.cluster import Cluster, Error

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.

Copy link
Member Author

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?

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

Copy link
Member Author

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...

@yershalom ?

@@ -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:

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

@yershalom
Copy link
Contributor

Hi @arikfr
Weird mistake, I pushed the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants