mytabi
mytabi

Reputation: 779

How to import xml package to databricks

Any one follow the following links before about xml https://github.com/databricks/spark-xml

I just keep having problem on importing import com.databricks.spark.xml._

Error

enter image description here

My databricks version

enter image description here

Actually I also want to know how to install the package

$SPARK_HOME/bin/spark-shell --packages com.databricks:spark-xml_2.12:0.5.0

Upvotes: 1

Views: 2370

Answers (2)

Ritesh
Ritesh

Reputation: 1034

You can install package/library by using import library option available in databricks homepage.

databricks-homepage

Here choose maven option and give maven coordinates or you have the privilege to search package as well

maven

enter image description here

After this you need to attach the library to your cluster by navigating Clusters>Libraries. Now you can directly use this library as below without importing it.

df = spark.read.format('com.databricks.spark.xml').options(rowTag='book').load(' /FileStore/tables/sample.xml')

Upvotes: 1

Ankit Tale
Ankit Tale

Reputation: 2004

Use this dependency in Android Studio:

// https://mvnrepository.com/artifact/com.databricks/spark-xml
compile group: 'com.databricks', name: 'spark-xml_2.12', version: '0.5.0'

For further assistance, follow this link:

https://mvnrepository.com/artifact/com.databricks

Upvotes: 0

Related Questions