Extract, Transform, and Load FinancialForce Data in Python

Ready to get started?

Download for a free trial:

Download Now

Learn more:

FinancialForce Python Connector

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

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

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

Connecting to FinancialForce Data

Connecting to FinancialForce 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 FinancialForce: 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 FinancialForce 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 FinancialForce.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 FinancialForce Sandbox Accounts

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

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

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

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

Create a SQL Statement to Query FinancialForce

Use SQL to create a statement for querying FinancialForce. 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 FinancialForce Data

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

Loading FinancialForce Data into a CSV File

table1 = etl.fromdb(cnxn,sql)

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


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

Adding New Rows to FinancialForce

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

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

With the CData Python Connector for FinancialForce, you can work with FinancialForce 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 FinancialForce Python Connector to start building Python apps and scripts with connectivity to FinancialForce 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.financialforce 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')


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

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