I am attempting to create a python script using the script snap to issue a batch request to a Cassandra cluster (the Cassandra script does not support batch operations for some reason), and I need a way to use the 'cassandra' library
I have looked through the documentation for a way to import python libraries that are not default things like random, but I can find no way to do this.
The specific import lines I am using are
from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider
But this obviously does not work because the Cassandra library for python is not installed on SnapLogic. I have no ability (AFAIK) to install libraries on SnapLogic. The specific error I get in case it is relevant is:
Failure: Cannot evaluate Script file: SQL_Demo_Cassandra_Script.py, Reason: ImportError: No module named cassandra in at line number 5, Resolution: Please fix the script file error at line: 5 column: -1
When you select Python in the Script snap it actually means Jython. So, you can, basically, import Java classes in your script.
So, you would need to get the driver (a JAR file) for Cassandra and upload it to all of the plex nodes and make sure to save it in the same path on all nodes.
Then you can add the JAR file to the path in the script and import the required classes.
Note: I have never tried it in SnapLogic.
Please refer to the StackOverflow question - Importing jars from Jython
Update #1:
Looks like this is the recommended way of using third party libraries.
From SnapLogic Docs:
Restrictions:
Refer to - SnapLogic Docs - Script Snap