- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to convert spark dataframes into xml files?
- Labels:
-
Apache Spark
Created ‎11-16-2016 01:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to convert spark data frames into xml files in scala. Very large data need to change from oracle database into xml files how can we do that?
Created ‎11-16-2016 10:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
https://spark-packages.org/package/HyukjinKwon/spark-xml has been moved to databricks: https://github.com/databricks/spark-xml for Spark 2.0 or for older: https://github.com/databricks/spark-xml/tree/branch-0.3
You should start the shell like this (check the proper version of spark-xml package):
spark-shell --packages com.databricks:spark-xml:0.1.1-s_2.10
+++
If this helped, please vote/accept best answer
Created ‎11-16-2016 02:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should use this package:
https://spark-packages.org/package/HyukjinKwon/spark-xml
val selectedData = df.select("author", "_id") selectedData.write .format("com.databricks.spark.xml") .option("rootTag", "books") .option("rowTag", "book") .save("newbooks.xml")
Created ‎11-19-2016 04:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
its working fine.But out put xml file saved in 10 files but I need in single file.How can we do that?
Created ‎11-16-2016 10:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
https://spark-packages.org/package/HyukjinKwon/spark-xml has been moved to databricks: https://github.com/databricks/spark-xml for Spark 2.0 or for older: https://github.com/databricks/spark-xml/tree/branch-0.3
You should start the shell like this (check the proper version of spark-xml package):
spark-shell --packages com.databricks:spark-xml:0.1.1-s_2.10
+++
If this helped, please vote/accept best answer
Created ‎11-19-2016 04:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you staca ...its working fine.But out put xml file saved in 10 files but I need in single file.How can we do that?
Created ‎04-14-2020 12:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you can use .repartition(1)
DF..repartition(1) .....
