How to work with Workday Data in Apache Spark using SQL



Access and process Workday Data in Apache Spark using the CData JDBC Driver.

Apache Spark is a fast and general engine for large-scale data processing. When paired with the CData JDBC Driver for Workday, Spark can work with live Workday data. This article describes how to connect to and query Workday data from a Spark shell.

The CData JDBC Driver offers unmatched performance for interacting with live Workday data due to optimized data processing built into the driver. When you issue complex SQL queries to Workday, the driver pushes supported SQL operations, like filters and aggregations, directly to Workday 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 Workday data using native data types.

About Workday Data Integration

CData provides the easiest way to access and integrate live data from Workday. Customers use CData connectivity to:

  • Access the tables and datasets you create in Prism Analytics Data Catalog, working with the native Workday data hub without compromising the fidelity of your Workday system.
  • Access Workday Reports-as-a-Service to surface data from departmental datasets not available from Prism and datasets larger than Prism allows.
  • Access base data objects with WQL, REST, or SOAP, getting more granular, detailed access but with the potential need for Workday admins or IT to help craft queries.

Users frequently integrate Workday with analytics tools such as Tableau, Power BI, and Excel, and leverage our tools to replicate Workday data to databases or data warehouses. Access is secured at the user level, based on the authenticated user's identity and role.

For more information on configuring Workday to work with CData, refer to our Knowledge Base articles: Comprehensive Workday Connectivity through Workday WQL and Reports-as-a-Service & Workday + CData: Connection & Integration Best Practices.


Getting Started


Install the CData JDBC Driver for Workday

Download the CData JDBC Driver for Workday installer, unzip the package, and run the JAR file to install the driver.

Start a Spark Shell and Connect to Workday Data

  1. Open a terminal and start the Spark shell with the CData JDBC Driver for Workday JAR file as the jars parameter: $ spark-shell --jars /CData/CData JDBC Driver for Workday/lib/cdata.jdbc.workday.jar
  2. With the shell running, you can connect to Workday with a JDBC URL and use the SQL Context load() function to read a table.

    To connect to Workday, users need to find the Tenant and BaseURL and then select their API type.

    Obtaining the BaseURL and Tenant

    To obtain the BaseURL and Tenant properties, log into Workday and search for "View API Clients." On this screen, you'll find the Workday REST API Endpoint, a URL that includes both the BaseURL and Tenant.

    The format of the REST API Endpoint is: https://domain.com/subdirectories/mycompany, where:

    • https://domain.com/subdirectories/ is the BaseURL.
    • mycompany (the portion of the url after the very last slash) is the Tenant.
    For example, in the REST API endpoint https://wd3-impl-services1.workday.com/ccx/api/v1/mycompany, the BaseURL is https://wd3-impl-services1.workday.com and the Tenant is mycompany.

    Using ConnectionType to Select the API

    The value you use for the ConnectionType property determines which Workday API you use. See our Community Article for more information on Workday connectivity options and best practices.

    APIConnectionType Value
    WQLWQL
    Reports as a ServiceReports
    RESTREST
    SOAPSOAP

    Authentication

    Your method of authentication depends on which API you are using.

    • WQL, Reports as a Service, REST: Use OAuth authentication.
    • SOAP: Use Basic or OAuth authentication.

    See the Help documentation for more information on configuring OAuth with Workday.

    Built-in Connection String Designer

    For assistance in constructing the JDBC URL, use the connection string designer built into the Workday JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.

    java -jar cdata.jdbc.workday.jar

    Fill in the connection properties and copy the connection string to the clipboard.

    Configure the connection to Workday, using the connection string generated above.

    scala> val workday_df = spark.sqlContext.read.format("jdbc").option("url", "jdbc:workday:User=myuser;Password=mypassword;Tenant=mycompany_gm1;BaseURL=https://wd3-impl-services1.workday.com;ConnectionType=WQL;").option("dbtable","Workers").option("driver","cdata.jdbc.workday.WorkdayDriver").load()
  3. Once you connect and the data is loaded you will see the table schema displayed.
  4. Register the Workday data as a temporary table:

    scala> workday_df.registerTable("workers")
  5. Perform custom SQL queries against the Data using commands like the one below:

    scala> workday_df.sqlContext.sql("SELECT Worker_Reference_WID, Legal_Name_Last_Name FROM Workers WHERE Legal_Name_Last_Name = Morgan").collect.foreach(println)

    You will see the results displayed in the console, similar to the following:

Using the CData JDBC Driver for Workday in Apache Spark, you are able to perform fast and complex analytics on Workday data, combining the power and utility of Spark with your data. Download a free, 30 day trial of any of the 200+ CData JDBC Drivers and get started today.

Ready to get started?

Download a free trial of the Workday Driver to get started:

 Download Now

Learn more:

Workday Icon Workday JDBC Driver

Rapidly create and deploy powerful Java applications that integrate with Workday.