Ready to get started?

Download a free trial of the Certinia Connector to get started:

 Download Now

Learn more:

Certinia Icon Certinia Python Connector

Python Connector Libraries for Certinia Data Connectivity. Integrate Certinia with popular Python tools like Pandas, SQLAlchemy, Dash & petl.

How to Build an ETL App for Certinia Data in Python with CData



Create ETL applications and real-time data pipelines for Certinia 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 Certinia and the petl framework, you can build Certinia-connected applications and pipelines for extracting, transforming, and loading Certinia data. This article shows how to connect to Certinia with the CData Python Connector and use petl and pandas to extract, transform, and load Certinia data.

With built-in, optimized data processing, the CData Python Connector offers unmatched performance for interacting with live Certinia data in Python. When you issue complex SQL queries from Certinia, the driver pushes supported SQL operations, like filters and aggregations, directly to Certinia and utilizes the embedded SQL engine to process unsupported operations client-side (often SQL functions and JOIN operations).

Connecting to Certinia Data

Connecting to Certinia 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.

There are several authentication methods available for connecting to Certinia: login credentials, SSO, and OAuth.

Authenticating with a Login and Token

Set the User and Password to your login credentials. Additionally, set the SecurityToken. By default, the SecurityToken is required, but you can make it optional by allowing a range of trusted IP addresses.

To disable the security token:

  1. Log in to Certinia and enter "Network Access" in the Quick Find box in the setup section.
  2. Add your IP address to the list of trusted IP addresses.

To obtain the security token:

  1. Open the personal information page on certinia.com.
  2. Click the link to reset your security token. The token will be emailed to you.
  3. Specify the security token in the SecurityToken connection property or append it to the Password.

Authenticating with OAuth

If you do not have access to the user name and password or do not want to require them, use the OAuth user consent flow. See the OAuth section in the Help for an authentication guide.

Connecting to Certinia Sandbox Accounts

Set UseSandbox to true (false by default) to use a Certinia sandbox account. Ensure that you specify a sandbox user name in User.

After installing the CData Certinia Connector, follow the procedure below to install the other required modules and start accessing Certinia 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 Certinia 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.certinia as mod

You can now connect with a connection string. Use the connect function for the CData Certinia Connector to create a connection for working with Certinia data.

cnxn = mod.connect("User=myUser;Password=myPassword;Security Token=myToken;InitiateOAuth=GETANDREFRESH;OAuthSettingsLocation=/PATH/TO/OAuthSettings.txt")")

Create a SQL Statement to Query Certinia

Use SQL to create a statement for querying Certinia. In this article, we read data from the Account entity.

sql = "SELECT BillingState, Name FROM Account WHERE Industry = 'Floppy Disks'"

Extract, Transform, and Load the Certinia Data

With the query results stored in a DataFrame, we can use petl to extract, transform, and load the Certinia data. In this example, we extract Certinia data, sort the data by the Name column, and load the data into a CSV file.

Loading Certinia Data into a CSV File

table1 = etl.fromdb(cnxn,sql)

table2 = etl.sort(table1,'Name')

etl.tocsv(table2,'account_data.csv')

In the following example, we add new rows to the Account table.

Adding New Rows to Certinia

table1 = [ ['BillingState','Name'], ['NewBillingState1','NewName1'], ['NewBillingState2','NewName2'], ['NewBillingState3','NewName3'] ]

etl.appenddb(table1, cnxn, 'Account')

With the CData Python Connector for Certinia, you can work with Certinia 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 Certinia to start building Python apps and scripts with connectivity to Certinia 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.certinia as mod

cnxn = mod.connect("User=myUser;Password=myPassword;Security Token=myToken;InitiateOAuth=GETANDREFRESH;OAuthSettingsLocation=/PATH/TO/OAuthSettings.txt")")

sql = "SELECT BillingState, Name FROM Account WHERE Industry = 'Floppy Disks'"

table1 = etl.fromdb(cnxn,sql)

table2 = etl.sort(table1,'Name')

etl.tocsv(table2,'account_data.csv')

table3 = [ ['BillingState','Name'], ['NewBillingState1','NewName1'], ['NewBillingState2','NewName2'], ['NewBillingState3','NewName3'] ]

etl.appenddb(table3, cnxn, 'Account')