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.
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 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 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.
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.
API | ConnectionType Value |
---|---|
WQL | WQL |
Reports as a Service | Reports |
REST | REST |
SOAP | SOAP |
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.
Below is a sample dbConnect call, including a typical JDBC connection string:
conn <- dbConnect(driver,"jdbc:workday:User=myuser;Password=mypassword;Tenant=mycompany_gm1;BaseURL=https://wd3-impl-services1.workday.com;ConnectionType=WQL;InitiateOAuth=GETANDREFRESH")
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)