Build Cloud-Native apps with Apache Cassandra

GOT QUESTIONS from the Workshop? You're in the right place! Post a question here and we'll get you answers.

Click here for Week 7 Materials and Homework.

Registrations still open!


question

narayana.jayanthi_191238 avatar image
narayana.jayanthi_191238 asked ·

Why can't my Python app from the workshop connect to Astra using keyspace 'killrvideocluster'?

[FOLLOW UP QUESTION TO #6684]

i followed the instructions... still no luck.. the zip file is in this location

SECURE_CONNECT_BUNDLE = '/workspace/cassandra-workshop-series/week3-AppDev-crud/secure-connect-killrvideocluster.zip'

when i execute db_connction.py, i have no errors.. for any other files, i get connection object error.

Attached is the error for your reference

Start exercise
Failure
Closing connection (up to 10s)
Traceback (most recent call last):
File "/workspace/cassandra-workshop-series/week3-AppDev-crud/crud-python/Ex02_Connect_to_Cassandra.py", line 17, in <module>
connection.close()
NameError: name 'connection' is not defined

Output making the changes to Ex02_Connect_to_Cassandra.py as per advice from Bettina:

Start exercise
("Unable to connect to any servers using keyspace 'killrvideocluster'", ['90e8bbef-ed20-460f-b5f1-389c4645f2f1-europe-west1.db.astra.datastax.com'])
Failure
workshop
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

bettina.swynnerton avatar image
bettina.swynnerton answered ·

We should have implemented some better error messages to troubleshoot these connection issues in more detail.

Please make the following change in the except block in the python code for Ex02_Connect_to_Cassandra.py, this should give you a much better idea where this is failing:

except Exception as e:
    print(e)
    print('Failure')

Don't forget to save, this catches me out sometimes on gitpod, no auto-save.

The error you posted points to the keyspace name:

"Unable to connect to any servers using keyspace 'killrvideocluster'"

In our workshop we generally use the name killrvideo for the keyspace, but you have something else set up. Once you fix the keyspace name, the app should work.

2 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Many thanks... It worked. I replaced killrvideocluster with killrvideo.. I have provided cluster name instead of keyspace name.. my mistake... Your help is highly appreciated... I am able to execute the files

1 Like 1 · ·

perfect, happy to hear that this is working now. Thanks for staying with it!

0 Likes 0 · ·