CData Python Connector for Sage X3 Cloud

Build 26.0.9770

From Petl

The connector can be used to create ETL applications and pipelines for CSV data in Python using Petl.

Install Required Modules

Install the Petl modules using the pip utility.
pip install petl

Connecting

After you import the modules, including the CData Python Connector for Sage X3 Cloud, you can use the connector's connect function to create a connection using a valid Sage X3 Cloud connection string. If you prefer not to use a direct connection, you can use a SQLAlchemy engine.
import petl as etl
import cdata.sagex3cloud as mod
cnxn = mod.connect("URL=https://x3server/;OAuthAccessTokenUrl=https://auth-domain/oauth/token;OAuthClientId=your_client_id;OAuthClientSecret=your_client_secret;Audience=https://api-audience;XAPIKey=your_api_key;Folder=SEED;")

Extract, Transform, and Load the Sage X3 Cloud Data

Create a SQL query string and store the query results in a DataFrame.
sql = "SELECT	Name, Description FROM Customer "
table1 = etl.fromdb(cnxn,sql)

Loading Data

With the query results stored in a DataFrame, you can load your data into any supported Petl destination. The following example loads the data into a CSV file.
etl.tocsv(table1,'output.csv')

Modifying Data

Insert new rows into Sage X3 Cloud tables using Petl's appenddb function.
table1 = [['Name','Description'],['Jon Doe','John']]
etl.appenddb(table1,cnxn,'Customer')

Copyright (c) 2026 CData Software, Inc. - All rights reserved.
Build 26.0.9770