How to connect to Cloudand/CouchDB using SparkSQL in DataScience Experience?

Viewed 1232

formerly CouchDB was supported via the cloudant connector:

https://github.com/cloudant-labs/spark-cloudant

But this project states that it is no longer active and that it moved to Apache Bahir:

http://bahir.apache.org/docs/spark/2.1.1/spark-sql-cloudant/

So I've installed the JAR in a Scala notebook using the following command:

%AddJar http://central.maven.org/maven2/org/apache/bahir/spark-sql-cloudant_2.11/2.1.1/spark-sql-cloudant_2.11-2.1.1.jar

Then, from a python notebook, after restarting the kernel, I use the following code to test:

spark = SparkSession\
    .builder\
    .appName("Cloudant Spark SQL Example in Python using dataframes")\
    .config("cloudant.host","0495289b-1beb-4e6d-888e-315f36925447-bluemix.cloudant.com")\
    .config("cloudant.username", "0495289b-1beb-4e6d-888e-315f36925447-bluemix")\
    .config("cloudant.password","xxx")\
    .config("jsonstore.rdd.partitions", 8)\
    .getOrCreate()

# ***1. Loading dataframe from Cloudant db
df = spark.read.load("openspace", "org.apache.bahir.cloudant")
df.cache()
df.printSchema()
df.show()

But I get:

java.lang.ClassNotFoundException: org.apache.bahir.cloudant.DefaultSource

(gist of full log)

2 Answers
Related