Ask Your Question

No module named cassandra in Jython Evaluator

asked 2019-03-13 08:26:32 -0500

Tutgirl gravatar image

updated 2019-03-19 02:04:16 -0500

Validation error: SCRIPTING_08 - Script error while running init script: javax.script.ScriptException: cassandra.cluster.NoHostAvailable: ('Unable to connect to any servers', {'': ConnectionShutdown('Connection to was closed',)}) in <script> at line number 16 : initScript

import sys sys.path.insert(0,'/usr/lib/python2.7/site-packages') from cassandra.cluster import Cluster from cassandra.auth import PlainTextAuthProvider auth_provider = PlainTextAuthProvider(username='XXX', password='XXXXX') try: session=Cluster(['10.XXX.XXX.XXX'],auth_provider=auth_provider).connect() rows = session.execute('select distinct version,site,report_date from sample.test_table') except Exception as e: raise e version = [row.version for row in rows]

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-13 09:26:12 -0500

iamontheinet gravatar image


Refer to this to see how you can install additional packages and then use them in Jython Evaluator processor.

Cheers, Dash

edit flag offensive delete link more


Hi Thanks for the reply. I did pip install cassandra-driver and followed the steps. But it is still giving me "No module error" in streamsets. Whereas I could successfully run the python program to connect Cassandra in Python 2.7.5 console of streamsets server. Is there any other additional config?

Tutgirl gravatar imageTutgirl ( 2019-03-18 06:30:24 -0500 )edit

Update the question and add your Jython code including entire stack trace.

iamontheinet gravatar imageiamontheinet ( 2019-03-18 15:37:26 -0500 )edit

I have updated the code

Tutgirl gravatar imageTutgirl ( 2019-03-19 02:18:08 -0500 )edit

Make sure sys.path is correct and you might also want to add "import cassandra" before accessing Cluster and PlainTextAuthProvider. (It works for me.)

iamontheinet gravatar imageiamontheinet ( 2019-03-19 02:45:35 -0500 )edit

sys.path is correct and imported cassandra too. Im still getting cassandra.cluster.NoHostAvailable: ('Unable to connect to any servers', {'': ConnectionShutdown('Connection to 10.XXX.XXX.XXX was closed',)}) Thanks

Tutgirl gravatar imageTutgirl ( 2019-03-19 02:57:49 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-03-13 08:26:32 -0500

Seen: 497 times

Last updated: Mar 19 '19