Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →How to Build an ETL App for Epicor Kinetic Data in Python with CData
Create ETL applications and real-time data pipelines for Epicor Kinetic data in Python with petl.
The rich ecosystem of Python modules lets you get to work quickly and integrate your systems more effectively. With the CData Python Connector for Epicor Kinetic and the petl framework, you can build Epicor Kinetic-connected applications and pipelines for extracting, transforming, and loading Epicor Kinetic data. This article shows how to connect to Epicor Kinetic with the CData Python Connector and use petl and pandas to extract, transform, and load Epicor Kinetic data.
With built-in, optimized data processing, the CData Python Connector offers unmatched performance for interacting with live Epicor Kinetic data in Python. When you issue complex SQL queries from Epicor Kinetic, the driver pushes supported SQL operations, like filters and aggregations, directly to Epicor Kinetic and utilizes the embedded SQL engine to process unsupported operations client-side (often SQL functions and JOIN operations).
Connecting to Epicor Kinetic Data
Connecting to Epicor Kinetic 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 successfully connect to your ERP instance, you must specify the following connection properties:
- Url:the URL of the server hosting your ERP instance. For example, https://myserver.EpicorSaaS.com
- ERPInstance: the name of your ERP instance.
- User: the username of your account.
- Password: the password of your account.
- Service: the service you want to retrieve data from. For example, BaqSvc.
In addition, you may also set the optional connection properties:
- ApiKey: An optional key that may be required for connection to some services depending on your account configuration.
- ApiVersion: Defaults to v1. May be set to v2 to use the newer Epicor API.
- Company: Required if you set the ApiVersion to v2.
After installing the CData Epicor Kinetic Connector, follow the procedure below to install the other required modules and start accessing Epicor Kinetic through Python objects.
Install Required Modules
Use the pip utility to install the required modules and frameworks:
pip install petl pip install pandas
Build an ETL App for Epicor Kinetic Data in Python
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.epicorerp as mod
You can now connect with a connection string. Use the connect function for the CData Epicor Kinetic Connector to create a connection for working with Epicor Kinetic data.
cnxn = mod.connect("Service=Erp.BO.CustomerSvc;ERPInstance=MyInstance;URL=https://myaccount.epicorsaas.com;User=username;Password=password;InitiateOAuth=GETANDREFRESH;OAuthSettingsLocation=/PATH/TO/OAuthSettings.txt")")
Create a SQL Statement to Query Epicor Kinetic
Use SQL to create a statement for querying Epicor Kinetic. In this article, we read data from the Customers entity.
sql = "SELECT CustNum, Company FROM Customers WHERE CompanyName = 'CompanyName'"
Extract, Transform, and Load the Epicor Kinetic Data
With the query results stored in a DataFrame, we can use petl to extract, transform, and load the Epicor Kinetic data. In this example, we extract Epicor Kinetic data, sort the data by the Company column, and load the data into a CSV file.
Loading Epicor Kinetic Data into a CSV File
table1 = etl.fromdb(cnxn,sql) table2 = etl.sort(table1,'Company') etl.tocsv(table2,'customers_data.csv')
In the following example, we add new rows to the Customers table.
Adding New Rows to Epicor Kinetic
table1 = [ ['CustNum','Company'], ['NewCustNum1','NewCompany1'], ['NewCustNum2','NewCompany2'], ['NewCustNum3','NewCompany3'] ] etl.appenddb(table1, cnxn, 'Customers')
With the CData Python Connector for Epicor Kinetic, you can work with Epicor Kinetic data just like you would with any database, including direct access to data in ETL packages like petl.
Free Trial & More Information
Download a free, 30-day trial of the CData Python Connector for Epicor Kinetic to start building Python apps and scripts with connectivity to Epicor Kinetic data. Reach out to our Support Team if you have any questions.
Full Source Code
import petl as etl import pandas as pd import cdata.epicorerp as mod cnxn = mod.connect("Service=Erp.BO.CustomerSvc;ERPInstance=MyInstance;URL=https://myaccount.epicorsaas.com;User=username;Password=password;InitiateOAuth=GETANDREFRESH;OAuthSettingsLocation=/PATH/TO/OAuthSettings.txt")") sql = "SELECT CustNum, Company FROM Customers WHERE CompanyName = 'CompanyName'" table1 = etl.fromdb(cnxn,sql) table2 = etl.sort(table1,'Company') etl.tocsv(table2,'customers_data.csv') table3 = [ ['CustNum','Company'], ['NewCustNum1','NewCompany1'], ['NewCustNum2','NewCompany2'], ['NewCustNum3','NewCompany3'] ] etl.appenddb(table3, cnxn, 'Customers')