How to write to Salesforce from Databricks using the spark salesforce library
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2023 04:59 AM
Hi, Im facing an issue while writing to Salesforce sandbox from Databricks. I have installed the "spark-salesforce_2.12-1.1.4" library and my code is as follows:-
df_newLeads.write\
.format("com.springml.spark.salesforce")\
.option("username","<<my username>>")\
.option("password","<<my password+security token>>")\
.option("login","https://test.salesforce.com")\
.option("sfObject","Lead")\
.option("upsert", True)\
.option("version","56.0")\
.save()
Im getting the following error:-
org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 13207.0 failed 4 times, most recent failure: Lost task 0.3 in stage 13207.0 (TID 10757) (10.139.64.4 executor 0): java.lang.IllegalArgumentException: Can not instantiate Stax reader for XML source type class org.codehaus.stax2.io.Stax2ByteArraySource (unrecognized type)
Meanwhile im able to read from salesforce using the following code
soql = "select id, name, amount from opportunity"
tets = spark\
.read\
.format("com.springml.spark.salesforce")\
.option("username","<<my username>>").option("password", "<<my password + security token>>")\
.option("soql", soql)\
.option("version", "56.0")\
.option("login","https://test.salesforce.com")\
.load()
- Labels:
-
Salesforce