Ready to get started?

Download a free trial of the Tableau CRM Analytics Connector to get started:

 Download Now

Learn more:

Tableau CRM Analytics Icon Tableau CRM Analytics Python Connector

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

How to Build an ETL App for Tableau CRM Analytics Data in Python with CData



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

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

Connecting to Tableau CRM Analytics Data

Connecting to Tableau CRM Analytics 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.

Tableau CRM Analytics uses the OAuth 2 authentication standard. You will need to obtain the OAuthClientId and OAuthClientSecret by registering an app with Tableau CRM Analytics.

See the Getting Started section of the Help documentation for an authentication guide.

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

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

cnxn = mod.connect("OAuthClientId=MyConsumerKey;OAuthClientSecret=MyConsumerSecret;CallbackURL=http://localhost:portNumber;InitiateOAuth=GETANDREFRESH;OAuthSettingsLocation=/PATH/TO/OAuthSettings.txt")")

Create a SQL Statement to Query Tableau CRM Analytics

Use SQL to create a statement for querying Tableau CRM Analytics. In this article, we read data from the Dataset_Opportunity entity.

sql = "SELECT Name, CloseDate FROM Dataset_Opportunity WHERE StageName = 'Closed Won'"

Extract, Transform, and Load the Tableau CRM Analytics Data

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

Loading Tableau CRM Analytics Data into a CSV File

table1 = etl.fromdb(cnxn,sql)

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

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

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

Adding New Rows to Tableau CRM Analytics

table1 = [ ['Name','CloseDate'], ['NewName1','NewCloseDate1'], ['NewName2','NewCloseDate2'], ['NewName3','NewCloseDate3'] ]

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

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

cnxn = mod.connect("OAuthClientId=MyConsumerKey;OAuthClientSecret=MyConsumerSecret;CallbackURL=http://localhost:portNumber;InitiateOAuth=GETANDREFRESH;OAuthSettingsLocation=/PATH/TO/OAuthSettings.txt")")

sql = "SELECT Name, CloseDate FROM Dataset_Opportunity WHERE StageName = 'Closed Won'"

table1 = etl.fromdb(cnxn,sql)

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

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

table3 = [ ['Name','CloseDate'], ['NewName1','NewCloseDate1'], ['NewName2','NewCloseDate2'], ['NewName3','NewCloseDate3'] ]

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