![]() |
VOOZH | about |
The rich ecosystem of Python modules lets you get to work quickly and integrate your systems more effectively. With the CData Python Connector for Workday and the petl framework, you can build Workday-connected applications and pipelines for extracting, transforming, and loading Workday data. This article shows how to connect to Workday with the CData Python Connector and use petl and pandas to extract, transform, and load Workday data.
With built-in, optimized data processing, the CData Python Connector offers unmatched performance for interacting with live Workday data in Python. When you issue complex SQL queries from Workday, the driver pushes supported SQL operations, like filters and aggregations, directly to Workday and utilizes the embedded SQL engine to process unsupported operations client-side (often SQL functions and JOIN operations).
CData provides the easiest way to access and integrate live data from Workday. Customers use CData connectivity to:
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.
Connecting to Workday data looks just like connecting to any relational data source. Create a connection string using the required connection properties. For this article, you will pass the connection string as a parameter to the create_engine function.
To connect to Workday, users need to find the Tenant and BaseURL and then select their API type.
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:
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 |
Your method of authentication depends on which API you are using.
See the Help documentation for more information on configuring OAuth with Workday.
After installing the CData Workday Connector, follow the procedure below to install the other required modules and start accessing Workday through Python objects.
Use the pip utility to install the required modules and frameworks:
pip install petl pip install pandas
Once the required modules and frameworks are installed, we are ready to build our ETL app. Code snippets follow, but the full source code is available at the end of the article.
First, be sure to import the modules (including the CData Connector) with the following:
import petl as etl import pandas as pd import cdata.workday as mod
You can now connect with a connection string. Use the connect function for the CData Workday Connector to create a connection for working with Workday data.
cnxn = mod.connect("User=myuser;Password=mypassword;Tenant=mycompany_gm1;BaseURL=https://wd3-impl-services1.workday.com;ConnectionType=WQL;InitiateOAuth=GETANDREFRESH;")
Use SQL to create a statement for querying Workday. In this article, we read data from the Workers entity.
sql = "SELECT Worker_Reference_WID, Legal_Name_Last_Name FROM Workers WHERE Legal_Name_Last_Name = 'Morgan'"
With the query results stored in a DataFrame, we can use petl to extract, transform, and load the Workday data. In this example, we extract Workday data, sort the data by the Legal_Name_Last_Name column, and load the data into a CSV file.
table1 = etl.fromdb(cnxn,sql) table2 = etl.sort(table1,'Legal_Name_Last_Name') etl.tocsv(table2,'workers_data.csv')
In the following example, we add new rows to the Workers table.
table1 = [ ['Worker_Reference_WID','Legal_Name_Last_Name'], ['NewWorker_Reference_WID1','NewLegal_Name_Last_Name1'], ['NewWorker_Reference_WID2','NewLegal_Name_Last_Name2'], ['NewWorker_Reference_WID3','NewLegal_Name_Last_Name3'] ] etl.appenddb(table1, cnxn, 'Workers')
With the CData Python Connector for Workday, you can work with Workday data just like you would with any database, including direct access to data in ETL packages like petl.
Download a free, 30-day trial of the CData Python Connector for Workday to start building Python apps and scripts with connectivity to Workday data. Reach out to our Support Team if you have any questions.
import petl as etl
import pandas as pd
import cdata.workday as mod
cnxn = mod.connect("User=myuser;Password=mypassword;Tenant=mycompany_gm1;BaseURL=https://wd3-impl-services1.workday.com;ConnectionType=WQL;InitiateOAuth=GETANDREFRESH;")
sql = "SELECT Worker_Reference_WID, Legal_Name_Last_Name FROM Workers WHERE Legal_Name_Last_Name = 'Morgan'"
table1 = etl.fromdb(cnxn,sql)
table2 = etl.sort(table1,'Legal_Name_Last_Name')
etl.tocsv(table2,'workers_data.csv')
table3 = [ ['Worker_Reference_WID','Legal_Name_Last_Name'], ['NewWorker_Reference_WID1','NewLegal_Name_Last_Name1'], ['NewWorker_Reference_WID2','NewLegal_Name_Last_Name2'], ['NewWorker_Reference_WID3','NewLegal_Name_Last_Name3'] ]
etl.appenddb(table3, cnxn, 'Workers')
Download a Community License of the Workday Connector to get started:
Download NowLearn more:
👁 Workday IconPython Connector Libraries for Workday Data Connectivity. Integrate Workday with popular Python tools like Pandas, SQLAlchemy, Dash & petl.