Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →Analyze Workday Data in R
Use standard R functions and the development environment of your choice to analyze Workday data with the CData JDBC Driver for Workday.
Access Workday data with pure R script and standard SQL on any machine where R and Java can be installed. You can use the CData JDBC Driver for Workday and the RJDBC package to work with remote Workday data in R. By using the CData Driver, you are leveraging a driver written for industry-proven standards to access your data in the popular, open-source R language. This article shows how to use the driver to execute SQL queries to Workday and visualize Workday data by calling standard R functions.
Install R
You can match the driver's performance gains from multi-threading and managed code by running the multithreaded Microsoft R Open or by running open R linked with the BLAS/LAPACK libraries. This article uses Microsoft R Open 3.2.3, which is preconfigured to install packages from the Jan. 1, 2016 snapshot of the CRAN repository. This snapshot ensures reproducibility.
Load the RJDBC Package
To use the driver, download the RJDBC package. After installing the RJDBC package, the following line loads the package:
library(RJDBC)
Connect to Workday as a JDBC Data Source
You will need the following information to connect to Workday as a JDBC data source:
- Driver Class: Set this to cdata.jdbc.workday.WorkdayDriver
- Classpath: Set this to the location of the driver JAR. By default this is the lib subfolder of the installation folder.
The DBI functions, such as dbConnect and dbSendQuery, provide a unified interface for writing data access code in R. Use the following line to initialize a DBI driver that can make JDBC requests to the CData JDBC Driver for Workday:
driver <- JDBC(driverClass = "cdata.jdbc.workday.WorkdayDriver", classPath = "MyInstallationDir\lib\cdata.jdbc.workday.jar", identifier.quote = "'")
You can now use DBI functions to connect to Workday and execute SQL queries. Initialize the JDBC connection with the dbConnect function.
To connect, there are three pieces of information required: Authentication, API URL, and WSDL URL.
Authentication
To authenticate, specify your User and Password. Note that you must append your Tenant to your User separated by an '@' character. For instance, if you normally log in with 'geraldg' and your Tenant is 'mycompany_mc1', then your User should be specified as 'geraldg@mycompany_mc1'.
API URL
The API URL may be specified either directly via APIURL, or it may be constructed from the Tenant, Service, and Host. The APIURL is constructed in the following format: <Host>/ccx/service/<Tenant>/<Service>.
WSDL URL
The WSDLURL may be specified in its entirety, or may be constructed from the Service and WSDLVersion connection properties. The WSDLURL is constructed in the following format: https://community.workday.com/sites/default/files/file-hosting/productionapi/<Service>/<WSDLVersion>/<Service>.wsdl
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.
Below is a sample dbConnect call, including a typical JDBC connection string:
conn <- dbConnect(driver,"jdbc:workday:User=myuser;Password=mypassword;Tenant=mycompany_gm1;Host=https://wd3-impl-services1.workday.com")
Schema Discovery
The driver models Workday APIs as relational tables, views, and stored procedures. Use the following line to retrieve the list of tables:
dbListTables(conn)
Execute SQL Queries
You can use the dbGetQuery function to execute any SQL query supported by the Workday API:
workers <- dbGetQuery(conn,"SELECT Worker_Reference_WID, Legal_Name_Last_Name FROM Workers WHERE Legal_Name_Last_Name = 'Morgan'")
You can view the results in a data viewer window with the following command:
View(workers)
Plot Workday Data
You can now analyze Workday data with any of the data visualization packages available in the CRAN repository. You can create simple bar plots with the built-in bar plot function:
par(las=2,ps=10,mar=c(5,15,4,2))
barplot(workers$Legal_Name_Last_Name, main="Workday Workers", names.arg = workers$Worker_Reference_WID, horiz=TRUE)