Set Up Live Data Query Using Python Client and Driver
- Download and install Python (v3.9 or above).
- Download the Live Data Query Python wheel file. See Live Data Query Downloads.
You can connect to Live Data Query using a Python script.
- Create thedataservice.propertiesfile with the following configuration details using the property=value format. For sample code, see the Example section below.We recommend that you place the properties file and the connector wheel file in the same Python project directory before installation and execution.PropertyISUUser-As-Selfwd.authn.authModelJWT_BEARERAUTHORIZATION_CODEwd.authn.clientIdClient ID created in the Live Data Query ISU setup.Client ID created in the User-As-Self Authentication setup.wd.authn.clientSecretN/AClient secret created in the User-As-Self Authentication setup.wd.authn.isuYour ISU.N/Awd.authn.accessTokenEndpointToken endpoint created in the Live Data Query ISU setup.Example:https://{HOST1}/ccx/oauth2/{TENANT}/tokenIf the client is behind a proxy server, specifywd.authn.accessTokenEndpoint=<proxy TokenEndpoint>.Token endpoint created in the User-As-Self Authentication setup.Example:https://{HOST1}/ccx/oauth2/{TENANT}/tokenIf the client is behind a proxy server, specifywd.authn.accessTokenEndpoint=<proxy TokenEndpoint>.wd.authn.authorizationEndpointN/AAuthorization endpoint created in the User-As-Self Authentication setup.Example:https://{HOST2}/{TENANT}/authorizewd.authn.privateKeyFilePathThe full path of the private key file.
- Windows Example:C:\Users\user.name\Documents\<privateKeyFile.txt>
- Mac Example:/Users/path/to/your/private_key.pem
For a Windows machine, you must specify thewd.authn.privateKeyFilePathproperty.Thewd.authn.privateKeyandwd.authn.privateKeyFilePathproperties are mutually exclusive. If you specifiedwd.authn.privateKey, don’t specifywd.authn.privateKeyFilePath.N/Awd.authn.privateKeyPrivacy-Enhanced Mail (PEM) format text. Must include the header/footer.Thewd.authn.privateKeyandwd.authn.privateKeyFilePathproperties are mutually exclusive. If you specifiedwd.authn.privateKey, don’t specifywd.authn.privateKeyFilePath.For information about the private key, see Generate Public and Private Keys for Workday Live Data Query.N/Awd.authn.redirectURLN/Ahttps://localhost:8888/callbackwd.hostThe {HOST1} value from the Token Endpoint on the API Client you created in the ISU setup.If the client is behind a proxy server, specifywd.host=<proxy host>.The {HOST1} value from the Token Endpoint on the API Client you created in the ISU setup.If the client is behind a proxy server, specifywd.host=<proxy host>.wd.port443443 - Install the Python library (wheel file) using the following command:pip3 install <wheel.whl>
- Create a Python script that loads the configuration from thedataservice.propertiesfile, creates a connection to the service, and executes the query.Example:from workday_ldq import DataServiceConfig, create_connection # Load configuration from current directory config = DataServiceConfig.from_file("dataservice.properties") # Create connection connection = create_connection(config) # Execute the Query cursor = connection.cursor() cursor.execute("SELECT * FROM {tablename} LIMIT 10") results = cursor.fetchall() cursor.close() connection.close()
dataservice.properties Sample Code
ISU Authentication | User-As-Self Authentication |
|---|---|
|
|