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

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

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

Connecting to Suadeo Data

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

The driver uses the OAuth 2.0 Resource Owner Password Credentials (ROPC) grant to authenticate to Suadeo. Authentication occurs directly using your credentials; there is no browser-based authorization flow or refresh token.

Set the following connection properties:

  • URL: The base URL of your Suadeo instance.
  • User: Your Suadeo username.
  • Password: Your Suadeo password.
  • AuthenticationName: The name identifier for the authentication configuration in your Suadeo instance. Different authentication names can be configured for different environments or use cases.

When you connect, the driver sends your credentials to the Suadeo OAuth token endpoint, receives an access token, and uses it for all subsequent requests. A new access token is obtained automatically when needed during the session.

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

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

cnxn = mod.connect("URL=https://mysuadeoinstance;User=username;Password=password;AuthenticationName=your_auth_name;")

Create a SQL Statement to Query Suadeo

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

sql = "SELECT Id, Name FROM Customers WHERE Status = 'Active'"

Extract, Transform, and Load the Suadeo Data

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

Loading Suadeo Data into a CSV File

table1 = etl.fromdb(cnxn,sql)

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

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

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

cnxn = mod.connect("URL=https://mysuadeoinstance;User=username;Password=password;AuthenticationName=your_auth_name;")

sql = "SELECT Id, Name FROM Customers WHERE Status = 'Active'"

table1 = etl.fromdb(cnxn,sql)

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

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

Ready to get started?

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

 Download Now

Learn more:

Suadeo Icon Suadeo Python Connector

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