![]() |
VOOZH | about |
Apache Spark is a fast and general engine for large-scale data processing. When paired with the CData JDBC Driver for Confluence, Spark can work with live Confluence data. This article describes how to connect to and query Confluence data from a Spark shell.
The CData JDBC Driver offers unmatched performance for interacting with live Confluence data due to optimized data processing built into the driver. When you issue complex SQL queries to Confluence, the driver pushes supported SQL operations, like filters and aggregations, directly to Confluence 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 Confluence data using native data types.
Download the CData JDBC Driver for Confluence installer, unzip the package, and run the JAR file to install the driver.
$ spark-shell --jars /CData/CData JDBC Driver for Confluence/lib/cdata.jdbc.confluence.jar
An API token is necessary for account authentication. To generate one, login to your Atlassian account and navigate to API tokens > Create API token. The generated token will be displayed.
To connect to a Cloud account, provide the following (Note: Password has been deprecated for connecting to a Cloud Account and is now used only to connect to a Server Instance.):
To connect to a Server instance, provide the following:
For assistance in constructing the JDBC URL, use the connection string designer built into the Confluence JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.
java -jar cdata.jdbc.confluence.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 Confluence, using the connection string generated above.
scala> val confluence_df = spark.sqlContext.read.format("jdbc").option("url", "jdbc:confluence:User=admin;APIToken=myApiToken;Url=https://yoursitename.atlassian.net;Timezone=America/New_York;").option("dbtable","Pages").option("driver","cdata.jdbc.confluence.ConfluenceDriver").load()
Register the Confluence data as a temporary table:
scala> confluence_df.registerTable("pages")
Perform custom SQL queries against the Data using commands like the one below:
scala> confluence_df.sqlContext.sql("SELECT Key, Name FROM Pages WHERE Id = 10000").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 Confluence in Apache Spark, you are able to perform fast and complex analytics on Confluence 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 Confluence Driver to get started:
Download NowLearn more:
👁 Confluence IconRapidly create and deploy powerful Java applications that integrate with Confluence.