![]() |
VOOZH | about |
Apache Spark is a fast and general engine for large-scale data processing. When paired with the CData JDBC Driver for Kintone, Spark can work with live Kintone data. This article describes how to connect to and query Kintone data from a Spark shell.
The CData JDBC Driver offers unmatched performance for interacting with live Kintone data due to optimized data processing built into the driver. When you issue complex SQL queries to Kintone, the driver pushes supported SQL operations, like filters and aggregations, directly to Kintone and utilizes the embedded SQL engine to process unsupported operations (often SQL functions and JOIN operations) client-side. With built-in dynamic metadata querying, you can work with and analyze Kintone data using native data types.
Download the CData JDBC Driver for Kintone installer, unzip the package, and run the JAR file to install the driver.
$ spark-shell --jars /CData/CData JDBC Driver for Kintone/lib/cdata.jdbc.kintone.jar
In addition to the authentication values, set the following parameters to connect to and retrieve data from Kintone:
Kintone supports the following authentication methods.
You must set the following to authenticate:
If the basic authentication security feature is set on the domain, supply the additional login credentials with BasicAuthUser and BasicAuthPassword. Basic authentication requires these credentials in addition to User and Password.
Instead of basic authentication, you can specify a client certificate to authenticate. Set SSLClientCert, SSLClientCertType, SSLClientCertSubject, and SSLClientCertPassword. Additionally, set User and Password to your login credentials.
For assistance in constructing the JDBC URL, use the connection string designer built into the Kintone JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.
java -jar cdata.jdbc.kintone.jar
Fill in the connection properties and copy the connection string to the clipboard.
👁 Using the built-in connection string designer to generate a JDBC URL (Salesforce is shown.)Configure the connection to Kintone, using the connection string generated above.
scala> val kintone_df = spark.sqlContext.read.format("jdbc").option("url", "jdbc:kintone:User=myuseraccount;Password=mypassword;Url=http://subdomain.domain.com;GuestSpaceId=myspaceid").option("dbtable","Comments").option("driver","cdata.jdbc.kintone.KintoneDriver").load()
Register the Kintone data as a temporary table:
scala> kintone_df.registerTable("comments")
Perform custom SQL queries against the Data using commands like the one below:
scala> kintone_df.sqlContext.sql("SELECT CreatorName, Text FROM Comments WHERE AppId = 1354841").collect.foreach(println)
You will see the results displayed in the console, similar to the following:
👁 Data in Apache Spark (Salesforce is shown)Using the CData JDBC Driver for Kintone in Apache Spark, you are able to perform fast and complex analytics on Kintone data, combining the power and utility of Spark with your data. Download a free, 30 day trial of any of the hundreds of CData JDBC Drivers and get started today.
Download a free trial of the Kintone Driver to get started:
Download NowLearn more:
👁 Kintone IconRapidly create and deploy powerful Java applications that integrate with Kintone applications and databases.