Apache Spark, the open source big data processing framework, was built for speed, ease and complex analytics. Learn how to access Salesforce data in Spark.
Spark has several comprehensive advantages to MapReduce technologies such as Hadoop and Storm. Spark has an advanced directed acyclic graph (DAG) pattern that supports cyclic data flows and also allows programmers to develop multi-step pipelines. Several tasks can be performed on the same data through in-memory data sharing across DAGs. Using Apache Spark, one can run up to 100 times faster in memory and that is one of the major reasons most organizations want to use Spark.
The tricky part is getting access to data stored in other applications to leverage the power of Spark. A common scenario we see is the development of sophisticated transformations in the Spark framework with cloud application data, such as Salesforce, Eloqua or Marketo. Many developers are turning to the Progress DataDirect Salesforce JDBC Driver and data source API of Spark to integrate Salesforce data in Spark. Sai Krishna Bobba, a developer evangelist for DataDirect connectors, created this quick tutorial below to help you get started with your connection:
spark-shell --jars /path_to_driver/sforce.jar
val dataframe_salesforce = sqlContext.read.format("jdbc").option("url","jdbc:datadirect:sforce://login.salesforce.com;").option("driver","com.ddtek.jdbc.sforce.SForceDriver").option("dbtable","SFORCE.<
table_name
>").option("user","<
Username
>").option("password","<
password
>").option("securitytoken","<
security_token
>").load()
dataframe_salesforce.registerTempTable("account")
dataframe_salesforce.sqlContext.sql("select * from account").collect.foreach(println)
You should be able to see your result as shown below:
We hope this tutorial helped you access Salesforce data and process your datasets in Spark. This demonstration is not limited to Salesforce. In fact, you can use the Spark’s DataSource API with any of the DataDirect JDBC Spark connectors or DataDirect Cloud JDBC Spark connectors to connect and integrate to over 50+ datasources including SaaS, Relational and Big data sources.
Please contact us if you have any questions and share your comments below.
Nishanth Kadiyala is a Technical Marketing Manager at Progress. He got his B.Tech degree from IIT Guwahati and his MBA from UNC Chapel Hill. He has worked on several technologies including database designing, SQL querying and Cloud Computing in the past. Currently, he is committed to educating enterprises about standards based connectivity via ODBC, JDBC, ADO.NET and OData. He is also proficient with DataDirect Hybrid Connectivity Services – DataDirect Cloud and Hybrid Data Pipeline. You can stay in touch with him through Twitter.
Subscribe to get all the news, info and tutorials you need to build better business apps and sites
Progress collects the Personal Information set out in our Privacy Policy and Privacy Policy for California Residents and uses it for the purposes stated in that policy.
You have the right to request deletion of your Personal Information at any time.
You can also ask us not to pass your Personal Information to third parties here: Do Not Sell My Info
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Copyright © 2021 Progress Software Corporation and/or its subsidiaries or affiliates.All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.